Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
WIP
  • Loading branch information
stuartmorgan-g committed Feb 8, 2021
commit 65de03a4cdd7bd261fe7c394e82a928dbb41703d
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MapEvent<T> {
/// A `MapEvent` associated to a `position`.
class _PositionedMapEvent<T> extends MapEvent<T> {
/// The position where this event happened.
final LatLng position;
final LatLng/*!*/ position;

/// Build a Positioned MapEvent, that relates a mapId and a position with a value.
///
Expand All @@ -73,11 +73,11 @@ class CameraMoveStartedEvent extends MapEvent<void> {
}

/// An event fired while the Camera of a [mapId] moves.
class CameraMoveEvent extends MapEvent<CameraPosition> {
class CameraMoveEvent extends MapEvent<CameraPosition/*!*/> {
/// Build a CameraMove Event triggered from the map represented by `mapId`.
///
/// The `value` of this event is a [CameraPosition] object with the current position of the Camera.
CameraMoveEvent(int mapId, CameraPosition position) : super(mapId, position);
CameraMoveEvent(int mapId, CameraPosition/*!*/ position) : super(mapId, position);
}

/// An event fired when the Camera of a [mapId] becomes idle.
Expand Down Expand Up @@ -141,13 +141,13 @@ class MapTapEvent extends _PositionedMapEvent<void> {
/// Build an MapTap Event triggered from the map represented by `mapId`.
///
/// The `position` of this event is the LatLng where the Map was tapped.
MapTapEvent(int mapId, LatLng position) : super(mapId, position, null);
MapTapEvent(int mapId, LatLng/*!*/ position) : super(mapId, position, null);
}

/// An event fired when a Map is long pressed.
class MapLongPressEvent extends _PositionedMapEvent<void> {
/// Build an MapTap Event triggered from the map represented by `mapId`.
///
/// The `position` of this event is the LatLng where the Map was long pressed.
MapLongPressEvent(int mapId, LatLng position) : super(mapId, position, null);
MapLongPressEvent(int mapId, LatLng/*!*/ position) : super(mapId, position, null);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import '../types/utils/tile_overlay.dart';
class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform {
// Keep a collection of id -> channel
// Every method call passes the int mapId
final Map<int, MethodChannel> _channels = {};
final Map<int, MethodChannel/*!*/> _channels = {};

/// Accesses the MethodChannel associated to the passed mapId.
MethodChannel channel(int mapId) {
Expand All @@ -43,8 +43,8 @@ class MethodChannelGoogleMapsFlutter extends GoogleMapsFlutterPlatform {
/// This method is called when the plugin is first initialized.
@override
Future<void> init(int mapId) {
MethodChannel channel;
if (!_channels.containsKey(mapId)) {
MethodChannel channel = _channels[mapId];
if (channel == null) {
channel = MethodChannel('plugins.flutter.io/google_maps_$mapId');
channel.setMethodCallHandler(
(MethodCall call) => _handleMethodCall(call, mapId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'dart:async' show Future;
import 'dart:typed_data' show Uint8List;
import 'dart:ui' show Size;

import 'package:flutter/material.dart'
show ImageConfiguration, AssetImage, AssetBundleImageKey;
Expand Down Expand Up @@ -110,14 +111,15 @@ class BitmapDescriptor {
AssetImage(assetName, package: package, bundle: bundle);
final AssetBundleImageKey assetBundleImageKey =
await assetImage.obtainKey(configuration);
final Size size = configuration?.size;
return BitmapDescriptor._(<dynamic>[
_fromAssetImage,
assetBundleImageKey.name,
assetBundleImageKey.scale,
if (kIsWeb && configuration?.size != null)
if (kIsWeb && size != null)
[
configuration.size.width,
configuration.size.height,
size.width,
size.height,
],
]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ class CameraPosition {
if (json == null) {
return null;
}
final LatLng target = LatLng.fromJson(json['target']);
if (target == null) {
return null;
}
return CameraPosition(
bearing: json['bearing'],
target: LatLng.fromJson(json['target']),
target: target,
tilt: json['tilt'],
zoom: json['zoom'],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Circle {
dynamic toJson() {
final Map<String, dynamic> json = <String, dynamic>{};

void addIfPresent(String fieldName, dynamic value) {
void addIfPresent(String fieldName, Object/*?*/ value) {
if (value != null) {
json[fieldName] = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class InfoWindow {
dynamic _toJson() {
final Map<String, dynamic> json = <String, dynamic>{};

void addIfPresent(String fieldName, dynamic value) {
void addIfPresent(String fieldName, Object/*?*/ value) {
if (value != null) {
json[fieldName] = value;
}
Expand Down Expand Up @@ -271,7 +271,7 @@ class Marker {
Map<String, dynamic> toJson() {
final Map<String, dynamic> json = <String, dynamic>{};

void addIfPresent(String fieldName, dynamic value) {
void addIfPresent(String fieldName, Object/*?*/ value) {
if (value != null) {
json[fieldName] = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class Polygon {
dynamic toJson() {
final Map<String, dynamic> json = <String, dynamic>{};

void addIfPresent(String fieldName, dynamic value) {
void addIfPresent(String fieldName, Object/*?*/ value) {
if (value != null) {
json[fieldName] = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class Polyline {
dynamic toJson() {
final Map<String, dynamic> json = <String, dynamic>{};

void addIfPresent(String fieldName, dynamic value) {
void addIfPresent(String fieldName, Object/*?*/ value) {
if (value != null) {
json[fieldName] = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Tile {
Map<String, dynamic> toJson() {
final Map<String, dynamic> json = <String, dynamic>{};

void addIfPresent(String fieldName, dynamic value) {
void addIfPresent(String fieldName, Object/*?*/ value) {
if (value != null) {
json[fieldName] = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class TileOverlay {
Map<String, dynamic> toJson() {
final Map<String, dynamic> json = <String, dynamic>{};

void addIfPresent(String fieldName, dynamic value) {
void addIfPresent(String fieldName, Object/*?*/ value) {
if (value != null) {
json[fieldName] = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ abstract class TileProvider {
/// Returns the tile to be used for this tile coordinate.
///
/// See [TileOverlay] for the specification of tile coordinates.
Future<Tile> getTile(int x, int y, int zoom);
Future<Tile> getTile(int/*!*/ x, int/*!*/ y, int zoom);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Map<CircleId, Circle> keyByCircleId(Iterable<Circle> circles) {
}

/// Converts a Set of Circles into something serializable in JSON.
List<Map<String, dynamic>> serializeCircleSet(Set<Circle> circles) {
List<Map<String, dynamic>> serializeCircleSet(Set<Circle/*!*/>/*!*/ circles) {
if (circles == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Map<MarkerId, Marker> keyByMarkerId(Iterable<Marker> markers) {
}

/// Converts a Set of Markers into something serializable in JSON.
List<Map<String, dynamic>> serializeMarkerSet(Set<Marker> markers) {
List<Map<String, dynamic>> serializeMarkerSet(Set<Marker/*!*/>/*!*/ markers) {
if (markers == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Map<PolygonId, Polygon> keyByPolygonId(Iterable<Polygon> polygons) {
}

/// Converts a Set of Polygons into something serializable in JSON.
List<Map<String, dynamic>> serializePolygonSet(Set<Polygon> polygons) {
List<Map<String, dynamic>> serializePolygonSet(Set<Polygon/*!*/>/*!*/ polygons) {
if (polygons == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Map<PolylineId, Polyline> keyByPolylineId(Iterable<Polyline> polylines) {
}

/// Converts a Set of Polylines into something serializable in JSON.
List<Map<String, dynamic>> serializePolylineSet(Set<Polyline> polylines) {
List<Map<String, dynamic>> serializePolylineSet(Set<Polyline/*!*/>/*!*/ polylines) {
if (polylines == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import '../types.dart';

/// Converts an [Iterable] of TileOverlay in a Map of TileOverlayId -> TileOverlay.
Map<TileOverlayId, TileOverlay> keyTileOverlayId(
Iterable<TileOverlay> tileOverlays) {
Map<TileOverlayId/*!*/, TileOverlay> keyTileOverlayId(
Iterable<TileOverlay>/*!*/ tileOverlays) {
if (tileOverlays == null) {
return <TileOverlayId, TileOverlay>{};
}
Expand All @@ -13,7 +13,7 @@ Map<TileOverlayId, TileOverlay> keyTileOverlayId(

/// Converts a Set of TileOverlays into something serializable in JSON.
List<Map<String, dynamic>> serializeTileOverlaySet(
Set<TileOverlay> tileOverlays) {
Set<TileOverlay/*!*/>/*!*/ tileOverlays) {
if (tileOverlays == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ dependencies:
flutter:
sdk: flutter
meta: ^1.0.5
plugin_platform_interface: ^1.0.1
stream_transform: ^1.2.0
plugin_platform_interface: ^1.1.0-nullsafety.2
stream_transform: ^2.0.0-nullsafety.0
collection: ^1.14.13

dev_dependencies:
flutter_test:
sdk: flutter
mockito: ^4.1.1
mockito: ^5.0.0-nullsafety.0
pedantic: ^1.8.0

environment:
Expand Down