Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

how to stop listening to location change listener on dispose in flutter

import 'dart:async';

StreamSubscription<LocationData> locationSubscription;

locationSubscription = location.onLocationChanged().listen((LocationData currentLocation)
{
  //Your code
});

// Then, somewhere in your code
locationSubscription.cancel();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #stop #listening #location #change #listener #dispose #flutter
ADD COMMENT
Topic
Name
7+5 =