Changed the method channel implementation
MODIFY
geolocator_platform_interface/CHANGELOG.md
geolocator_platform_interface/CHANGELOG.md
+## 2.0.3
+
+- Solved a bug which caused the distanceFilter/timeInterval not to update after initializing a new PositionStream (see issue [#703](https://github.com/Baseflow/flutter-geolocator/issues/703)).
+
## 2.0.2
- Added definition of the `ActivityMissingException`.

MODIFY
geolocator_platform_interface/lib/src/implementations/method_channel_geolocator.dart
geolocator_platform_interface/lib/src/implementations/method_channel_geolocator.dart
@@ -179,7 +179,8 @@ class MethodChannelGeolocator extends GeolocatorPlatform {
late StreamSubscription subscription;
late StreamController<dynamic> controller;
controller = StreamController<dynamic>(
- onListen: () => subscription = incoming.listen((item) => controller.add(item)),
+ onListen: () =>
+ subscription = incoming.listen((item) => controller.add(item)),
onPause: () => subscription.pause(),
onResume: () => subscription.resume(),
onCancel: () {

MODIFY
geolocator_platform_interface/pubspec.yaml
geolocator_platform_interface/pubspec.yaml
@@ -3,7 +3,7 @@ description: A common platform interface for the geolocator plugin.
homepage: https://github.com/baseflow/flutter-geolocator
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
-version: 2.0.2
+version: 2.0.3
dependencies:
flutter:

MODIFY
geolocator_platform_interface/test/src/implementations/method_channel_geolocator_test.dart
geolocator_platform_interface/test/src/implementations/method_channel_geolocator_test.dart
@@ -558,8 +558,6 @@ void main() {
final methodChannelGeolocator = MethodChannelGeolocator();
final firstStream = methodChannelGeolocator.getPositionStream(
distanceFilter: 10);
- final secondStream = methodChannelGeolocator.getPositionStream(
- distanceFilter: 100);
// Start listening so u can cancel the stream subscription
StreamSubscription<Position>? firstSubscription =
@@ -569,13 +567,8 @@ void main() {
firstSubscription.cancel();
firstSubscription = null;
- // Start listening to second stream so u can cancel the subscription
- StreamSubscription<Position>? secondSubscription =
- secondStream.listen((event) { });
-
- // Cancel subscription
- secondSubscription.cancel();
- secondSubscription = null;
+ final secondStream = methodChannelGeolocator.getPositionStream(
+ distanceFilter: 100);
// Pro stream different options are used, thus the stream shouldn't
// be the same

Changed the method channel implementation