Skip to content

Commit

Permalink
Revert platform position changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wackymax committed Apr 11, 2022
1 parent 0663c6b commit 8a561de
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ public static Map<String, Object> toHashMap(Location location) {
}

if(location.getExtras() != null) {
String nmeaMessage = location.getExtras().getString(NmeaClient.NMEA_MESSAGE_EXTRA);

if(nmeaMessage != null) {
position.put("nmeaMessage", nmeaMessage);
}
if(location.getExtras().containsKey(NmeaClient.NMEA_ALTITUDE_EXTRA)) {
Double mslAltitude = location.getExtras().getDouble(NmeaClient.NMEA_ALTITUDE_EXTRA);
position.put("altitude", mslAltitude);
Expand Down
2 changes: 1 addition & 1 deletion geolocator_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ flutter:
dependencies:
flutter:
sdk: flutter
geolocator_platform_interface: ^4.1.0
geolocator_platform_interface: ^4.0.3

dev_dependencies:
flutter_test:
Expand Down
4 changes: 0 additions & 4 deletions geolocator_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
## 4.1.0

- Adds 'nmeaMessage' to the position model.

## 4.0.4

- Fixes a bug where listening to the position stream immediately after an error, results in listening to a dead stream.
Expand Down
13 changes: 2 additions & 11 deletions geolocator_platform_interface/lib/src/models/position.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class Position {
required this.speedAccuracy,
this.floor,
this.isMocked = false,
this.nmeaMessage,
});

/// The latitude of this position in degrees normalized to the interval -90.0
Expand Down Expand Up @@ -75,10 +74,6 @@ class Position {
/// On iOS this value will always be false.
final bool isMocked;

/// Provides the latest nmeaMessage received from the platform if requested
/// and the platform is capable of providing nmeaMessages.
final String? nmeaMessage;

@override
bool operator ==(Object other) {
var areEqual = other is Position &&
Expand All @@ -91,8 +86,7 @@ class Position {
other.speed == speed &&
other.speedAccuracy == speedAccuracy &&
other.timestamp == timestamp &&
other.isMocked == isMocked &&
other.nmeaMessage == nmeaMessage;
other.isMocked == isMocked;

return areEqual;
}
Expand All @@ -108,8 +102,7 @@ class Position {
speed.hashCode ^
speedAccuracy.hashCode ^
timestamp.hashCode ^
isMocked.hashCode ^
nmeaMessage.hashCode;
isMocked.hashCode;

@override
String toString() {
Expand Down Expand Up @@ -146,7 +139,6 @@ class Position {
speed: positionMap['speed'] ?? 0.0,
speedAccuracy: positionMap['speed_accuracy'] ?? 0.0,
isMocked: positionMap['is_mocked'] ?? false,
nmeaMessage: positionMap['nmeaMessage'],
);
}

Expand All @@ -163,6 +155,5 @@ class Position {
'speed': speed,
'speed_accuracy': speedAccuracy,
'is_mocked': isMocked,
'nmeaMessage': nmeaMessage,
};
}
2 changes: 1 addition & 1 deletion geolocator_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 4.1.0
version: 4.0.4

dependencies:
flutter:
Expand Down

0 comments on commit 8a561de

Please sign in to comment.