diff --git a/packages/location_platform_interface/CHANGELOG.md b/packages/location_platform_interface/CHANGELOG.md index a88dfb19..86731124 100644 --- a/packages/location_platform_interface/CHANGELOG.md +++ b/packages/location_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.1.1 + +- Fix cast error in `Location.onLocationChanged` (#871) + ## 3.1.0 - Refactoring (#853) diff --git a/packages/location_platform_interface/lib/src/method_channel_location.dart b/packages/location_platform_interface/lib/src/method_channel_location.dart index 09dfa4f1..cbe4ba1b 100644 --- a/packages/location_platform_interface/lib/src/method_channel_location.dart +++ b/packages/location_platform_interface/lib/src/method_channel_location.dart @@ -140,12 +140,15 @@ class MethodChannelLocation extends LocationPlatform { /// Throws an error if the app has no permission to access location. @override Stream get onLocationChanged { - return _onLocationChanged ??= - _eventChannel!.receiveBroadcastStream().map( - (dynamic event) => LocationData.fromMap( - Map.of(event as Map), - ), - ); + return _onLocationChanged ??= _eventChannel! + .receiveBroadcastStream() + .map((dynamic event) { + event as Map; + + return LocationData.fromMap( + Map.of(event.cast()), + ); + }); } /// Change options of sticky background notification on Android. diff --git a/packages/location_platform_interface/pubspec.yaml b/packages/location_platform_interface/pubspec.yaml index 06adced1..a32dde34 100644 --- a/packages/location_platform_interface/pubspec.yaml +++ b/packages/location_platform_interface/pubspec.yaml @@ -1,6 +1,6 @@ name: location_platform_interface description: A common platform interface for the location plugin. -version: 3.1.0 +version: 3.1.1 homepage: https://github.com/Lyokone/flutterlocation environment: