Skip to content

Commit

Permalink
fix: Updated new features for nullability
Browse files Browse the repository at this point in the history
Features that were added before the pull request from @jonbhanson were
updated to support nullability.
  • Loading branch information
LuisThein committed Mar 28, 2021
1 parent 40427ef commit f892244
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 1.0.0

Tanks to @jonbhanson
* Adds null safety.
* Refreshes the example app.
* Updates .gitignore and removes files that should not be tracked.
Expand Down
2 changes: 1 addition & 1 deletion example/lib/annotation_icons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class AnnotationIconsBodyState extends State<AnnotationIconsBody> {
annotationId: AnnotationId("annotation_1"),
anchor: Offset(0.5, -4),
position: LatLng(52.707755, -2.7540658),
icon: _annotationIcon!,
icon: _annotationIcon ?? BitmapDescriptor.defaultAnnotation,
),
].toSet();
}
Expand Down
2 changes: 1 addition & 1 deletion example/lib/place_annotation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class PlaceAnnotationBodyState extends State<PlaceAnnotationBody> {
final Annotation? tappedAnnotation = annotations[annotationId];
if (tappedAnnotation != null) {
setState(() {
if (annotations.containsKey(selectedAnnotation)) {
if (annotations.containsKey(tappedAnnotation)) {
final Annotation resetOld =
annotations[selectedAnnotation]!.copyWith();
annotations[selectedAnnotation] = resetOld;
Expand Down
10 changes: 4 additions & 6 deletions lib/src/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,20 +219,18 @@ class AppleMapController {
return LatLngBounds(northeast: northeast, southwest: southwest);
}


/// A projection is used to translate between on screen location and geographic coordinates.
/// Screen location is in screen pixels (not display pixels) with respect to the top left corner
/// of the map, not necessarily of the whole screen.
Future<Offset> getScreenCoordinate(LatLng latLng) async {
Future<Offset?> getScreenCoordinate(LatLng latLng) async {
final point = await channel
.invokeMapMethod<String, dynamic>(
'camera#convert', <String, dynamic>{
.invokeMapMethod<String, dynamic>('camera#convert', <String, dynamic>{
'annotation': [latLng.latitude, latLng.longitude]
});
if (!point.containsKey('point')) {
if (point != null && !point.containsKey('point')) {
return null;
}
final doubles = List<double>.from(point['point']);
final doubles = List<double>.from(point?['point']);
return Offset(doubles.first, doubles.last);
}
}

0 comments on commit f892244

Please sign in to comment.