diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
index f90a2517bd75..8d4db55c004b 100644
--- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
+++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
@@ -1,3 +1,6 @@
+## 0.5.25
+* Move MethodChannel code to MethodChannelGoogleMapsFlutter(Flutter Platform Interface)
+
## 0.5.24+1
* Make the pedantic dev_dependency explicit.
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/.gitignore b/packages/google_maps_flutter/google_maps_flutter/example/.gitignore
new file mode 100644
index 000000000000..78b3c2b33643
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter/example/.gitignore
@@ -0,0 +1,40 @@
+# Miscellaneous
+*.class
+*.log
+*.pyc
+*.swp
+.DS_Store
+.atom/
+.buildlog/
+.history
+.svn/
+
+# IntelliJ related
+*.iml
+*.ipr
+*.iws
+.idea/
+
+# The .vscode folder contains launch configuration and tasks you configure in
+# VS Code which you may wish to be included in version control, so this line
+# is commented out by default.
+#.vscode/
+
+# Flutter/Dart/Pub related
+**/doc/api/
+.dart_tool/
+.flutter-plugins
+.flutter-plugins-dependencies
+.packages
+.pub-cache/
+.pub/
+/build/
+
+# Web related
+lib/generated_plugin_registrant.dart
+
+# Symbolication related
+app.*.symbols
+
+# Exceptions to above rules.
+!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/android/.gitignore b/packages/google_maps_flutter/google_maps_flutter/example/android/.gitignore
new file mode 100644
index 000000000000..bc2100d8f75e
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter/example/android/.gitignore
@@ -0,0 +1,7 @@
+gradle-wrapper.jar
+/.gradle
+/captures/
+/gradlew
+/gradlew.bat
+/local.properties
+GeneratedPluginRegistrant.java
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/android/app/src/main/kotlin/io/flutter/plugins/example/MainActivity.kt b/packages/google_maps_flutter/google_maps_flutter/example/android/app/src/main/kotlin/io/flutter/plugins/example/MainActivity.kt
new file mode 100644
index 000000000000..5917557e48ab
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter/example/android/app/src/main/kotlin/io/flutter/plugins/example/MainActivity.kt
@@ -0,0 +1,12 @@
+package io.flutter.plugins.example
+
+import androidx.annotation.NonNull;
+import io.flutter.embedding.android.FlutterActivity
+import io.flutter.embedding.engine.FlutterEngine
+import io.flutter.plugins.GeneratedPluginRegistrant
+
+class MainActivity: FlutterActivity() {
+ override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
+ GeneratedPluginRegistrant.registerWith(flutterEngine);
+ }
+}
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/ios/.gitignore b/packages/google_maps_flutter/google_maps_flutter/example/ios/.gitignore
new file mode 100644
index 000000000000..e96ef602b8d1
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter/example/ios/.gitignore
@@ -0,0 +1,32 @@
+*.mode1v3
+*.mode2v3
+*.moved-aside
+*.pbxuser
+*.perspectivev3
+**/*sync/
+.sconsign.dblite
+.tags*
+**/.vagrant/
+**/DerivedData/
+Icon?
+**/Pods/
+**/.symlinks/
+profile
+xcuserdata
+**/.generated/
+Flutter/App.framework
+Flutter/Flutter.framework
+Flutter/Flutter.podspec
+Flutter/Generated.xcconfig
+Flutter/app.flx
+Flutter/app.zip
+Flutter/flutter_assets/
+Flutter/flutter_export_environment.sh
+ServiceDefinitions.json
+Runner/GeneratedPluginRegistrant.*
+
+# Exceptions to above rules.
+!default.mode1v3
+!default.mode2v3
+!default.pbxuser
+!default.perspectivev3
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 000000000000..18d981003d68
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 000000000000..f9b0d7c5ea15
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ PreviewsEnabled
+
+
+
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 000000000000..18d981003d68
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 000000000000..f9b0d7c5ea15
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ PreviewsEnabled
+
+
+
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner/AppDelegate.swift b/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner/AppDelegate.swift
new file mode 100644
index 000000000000..70693e4a8c12
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner/AppDelegate.swift
@@ -0,0 +1,13 @@
+import UIKit
+import Flutter
+
+@UIApplicationMain
+@objc class AppDelegate: FlutterAppDelegate {
+ override func application(
+ _ application: UIApplication,
+ didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
+ ) -> Bool {
+ GeneratedPluginRegistrant.register(with: self)
+ return super.application(application, didFinishLaunchingWithOptions: launchOptions)
+ }
+}
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner/Runner-Bridging-Header.h b/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner/Runner-Bridging-Header.h
new file mode 100644
index 000000000000..308a2a560b42
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter/example/ios/Runner/Runner-Bridging-Header.h
@@ -0,0 +1 @@
+#import "GeneratedPluginRegistrant.h"
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml
index c7b2c5ff6715..2a3ecc5b4892 100644
--- a/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml
+++ b/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml
@@ -11,6 +11,7 @@ dependencies:
google_maps_flutter:
path: ../
flutter_plugin_android_lifecycle: ^1.0.0
+ google_maps: ">=3.0.0 <4.0.0"
dev_dependencies:
flutter_driver:
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/test/widget_test.dart b/packages/google_maps_flutter/google_maps_flutter/example/test/widget_test.dart
new file mode 100644
index 000000000000..747db1da35e8
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter/example/test/widget_test.dart
@@ -0,0 +1,30 @@
+// This is a basic Flutter widget test.
+//
+// To perform an interaction with a widget in your test, use the WidgetTester
+// utility that Flutter provides. For example, you can send tap and scroll
+// gestures. You can also use WidgetTester to find child widgets in the widget
+// tree, read text, and verify that the values of widget properties are correct.
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+import 'package:example/main.dart';
+
+void main() {
+ testWidgets('Counter increments smoke test', (WidgetTester tester) async {
+ // Build our app and trigger a frame.
+ await tester.pumpWidget(MyApp());
+
+ // Verify that our counter starts at 0.
+ expect(find.text('0'), findsOneWidget);
+ expect(find.text('1'), findsNothing);
+
+ // Tap the '+' icon and trigger a frame.
+ await tester.tap(find.byIcon(Icons.add));
+ await tester.pump();
+
+ // Verify that our counter has incremented.
+ expect(find.text('0'), findsNothing);
+ expect(find.text('1'), findsOneWidget);
+ });
+}
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/web/favicon.png b/packages/google_maps_flutter/google_maps_flutter/example/web/favicon.png
new file mode 100644
index 000000000000..8aaa46ac1ae2
Binary files /dev/null and b/packages/google_maps_flutter/google_maps_flutter/example/web/favicon.png differ
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-192.png b/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-192.png
new file mode 100644
index 000000000000..b749bfef0747
Binary files /dev/null and b/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-192.png differ
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-512.png b/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-512.png
new file mode 100644
index 000000000000..88cfd48dff11
Binary files /dev/null and b/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-512.png differ
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/web/index.html b/packages/google_maps_flutter/google_maps_flutter/example/web/index.html
new file mode 100644
index 000000000000..bf817badbc9a
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter/example/web/index.html
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ example
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/google_maps_flutter/google_maps_flutter/example/web/manifest.json b/packages/google_maps_flutter/google_maps_flutter/example/web/manifest.json
new file mode 100644
index 000000000000..c63800102369
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter/example/web/manifest.json
@@ -0,0 +1,23 @@
+{
+ "name": "example",
+ "short_name": "example",
+ "start_url": ".",
+ "display": "minimal-ui",
+ "background_color": "#0175C2",
+ "theme_color": "#0175C2",
+ "description": "A new Flutter project.",
+ "orientation": "portrait-primary",
+ "prefer_related_applications": false,
+ "icons": [
+ {
+ "src": "icons/Icon-192.png",
+ "sizes": "192x192",
+ "type": "image/png"
+ },
+ {
+ "src": "icons/Icon-512.png",
+ "sizes": "512x512",
+ "type": "image/png"
+ }
+ ]
+}
diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart b/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart
index 5f3889f7b2f1..e1481e4896fc 100644
--- a/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart
@@ -13,6 +13,8 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
+
part 'src/bitmap.dart';
part 'src/callbacks.dart';
part 'src/camera.dart';
diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart b/packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart
index 3dcea9c2bbac..d68213b16d91 100644
--- a/packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart
@@ -4,14 +4,16 @@
part of google_maps_flutter;
+final GoogleMapsFlutterPlatform _googleMapsFlutterPlatform =
+ GoogleMapsFlutterPlatform.instance;
+
/// Controller for a single GoogleMap instance running on the host platform.
class GoogleMapController {
GoogleMapController._(
- this.channel,
CameraPosition initialCameraPosition,
this._googleMapState,
- ) : assert(channel != null) {
- channel.setMethodCallHandler(_handleMethodCall);
+ ) : assert(_googleMapsFlutterPlatform != null) {
+ _googleMapsFlutterPlatform.setMethodCallHandler(_handleMethodCall);
}
/// Initialize control of a [GoogleMap] with [id].
@@ -24,11 +26,8 @@ class GoogleMapController {
_GoogleMapState googleMapState,
) async {
assert(id != null);
- final MethodChannel channel =
- MethodChannel('plugins.flutter.io/google_maps_$id');
- await channel.invokeMethod('map#waitForMap');
+ _googleMapsFlutterPlatform.init(id);
return GoogleMapController._(
- channel,
initialCameraPosition,
googleMapState,
);
@@ -38,7 +37,7 @@ class GoogleMapController {
///
/// Accessible only for testing.
@visibleForTesting
- final MethodChannel channel;
+ MethodChannel channel;
final _GoogleMapState _googleMapState;
@@ -100,12 +99,7 @@ class GoogleMapController {
/// The returned [Future] completes after listeners have been notified.
Future _updateMapOptions(Map optionsUpdate) async {
assert(optionsUpdate != null);
- await channel.invokeMethod(
- 'map#update',
- {
- 'options': optionsUpdate,
- },
- );
+ await _googleMapsFlutterPlatform.updateMapOptions(optionsUpdate);
}
/// Updates marker configuration.
@@ -116,10 +110,7 @@ class GoogleMapController {
/// The returned [Future] completes after listeners have been notified.
Future _updateMarkers(_MarkerUpdates markerUpdates) async {
assert(markerUpdates != null);
- await channel.invokeMethod(
- 'markers#update',
- markerUpdates._toMap(),
- );
+ await _googleMapsFlutterPlatform.updateMarkers(markerUpdates._toMap());
}
/// Updates polygon configuration.
@@ -130,10 +121,7 @@ class GoogleMapController {
/// The returned [Future] completes after listeners have been notified.
Future _updatePolygons(_PolygonUpdates polygonUpdates) async {
assert(polygonUpdates != null);
- await channel.invokeMethod(
- 'polygons#update',
- polygonUpdates._toMap(),
- );
+ await _googleMapsFlutterPlatform.updatePolygons(polygonUpdates._toMap());
}
/// Updates polyline configuration.
@@ -144,10 +132,7 @@ class GoogleMapController {
/// The returned [Future] completes after listeners have been notified.
Future _updatePolylines(_PolylineUpdates polylineUpdates) async {
assert(polylineUpdates != null);
- await channel.invokeMethod(
- 'polylines#update',
- polylineUpdates._toMap(),
- );
+ await _googleMapsFlutterPlatform.updatePolylines(polylineUpdates._toMap());
}
/// Updates circle configuration.
@@ -158,10 +143,7 @@ class GoogleMapController {
/// The returned [Future] completes after listeners have been notified.
Future _updateCircles(_CircleUpdates circleUpdates) async {
assert(circleUpdates != null);
- await channel.invokeMethod(
- 'circles#update',
- circleUpdates._toMap(),
- );
+ await _googleMapsFlutterPlatform.updateCircles(circleUpdates._toMap());
}
/// Starts an animated change of the map camera position.
@@ -169,9 +151,7 @@ class GoogleMapController {
/// The returned [Future] completes after the change has been started on the
/// platform side.
Future animateCamera(CameraUpdate cameraUpdate) async {
- await channel.invokeMethod('camera#animate', {
- 'cameraUpdate': cameraUpdate._toJson(),
- });
+ await _googleMapsFlutterPlatform.animateCamera(cameraUpdate._toJson());
}
/// Changes the map camera position.
@@ -179,9 +159,7 @@ class GoogleMapController {
/// The returned [Future] completes after the change has been made on the
/// platform side.
Future moveCamera(CameraUpdate cameraUpdate) async {
- await channel.invokeMethod('camera#move', {
- 'cameraUpdate': cameraUpdate._toJson(),
- });
+ await _googleMapsFlutterPlatform.moveCamera(cameraUpdate._toJson());
}
/// Sets the styling of the base map.
@@ -198,18 +176,13 @@ class GoogleMapController {
/// and [Android](https://developers.google.com/maps/documentation/android-sdk/style-reference)
/// style reference for more information regarding the supported styles.
Future setMapStyle(String mapStyle) async {
- final List successAndError =
- await channel.invokeMethod>('map#setStyle', mapStyle);
- final bool success = successAndError[0];
- if (!success) {
- throw MapStyleException(successAndError[1]);
- }
+ await _googleMapsFlutterPlatform.setMapStyle(mapStyle);
}
/// Return [LatLngBounds] defining the region that is visible in a map.
Future getVisibleRegion() async {
final Map latLngBounds =
- await channel.invokeMapMethod('map#getVisibleRegion');
+ await _googleMapsFlutterPlatform.getVisibleRegion();
final LatLng southwest = LatLng._fromJson(latLngBounds['southwest']);
final LatLng northeast = LatLng._fromJson(latLngBounds['northeast']);
@@ -222,8 +195,8 @@ class GoogleMapController {
/// 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 getScreenCoordinate(LatLng latLng) async {
- final Map point = await channel.invokeMapMethod(
- 'map#getScreenCoordinate', latLng._toJson());
+ final Map point =
+ await _googleMapsFlutterPlatform.getScreenCoordinate(latLng._toJson());
return ScreenCoordinate(x: point['x'], y: point['y']);
}
@@ -232,8 +205,8 @@ class GoogleMapController {
/// Returned [LatLng] corresponds to a screen location. The screen location is specified in screen
/// pixels (not display pixels) relative to the top left of the map, not top left of the whole screen.
Future getLatLng(ScreenCoordinate screenCoordinate) async {
- final List latLng = await channel.invokeMethod>(
- 'map#getLatLng', screenCoordinate._toJson());
+ final List latLng =
+ await _googleMapsFlutterPlatform.getLatLng(screenCoordinate._toJson());
return LatLng(latLng[0], latLng[1]);
}
@@ -247,8 +220,7 @@ class GoogleMapController {
/// * [isMarkerInfoWindowShown] to check if the Info Window is showing.
Future showMarkerInfoWindow(MarkerId markerId) async {
assert(markerId != null);
- await channel.invokeMethod(
- 'markers#showInfoWindow', {'markerId': markerId.value});
+ await _googleMapsFlutterPlatform.showMarkerInfoWindow(markerId.value);
}
/// Programmatically hide the Info Window for a [Marker].
@@ -261,8 +233,7 @@ class GoogleMapController {
/// * [isMarkerInfoWindowShown] to check if the Info Window is showing.
Future hideMarkerInfoWindow(MarkerId markerId) async {
assert(markerId != null);
- await channel.invokeMethod(
- 'markers#hideInfoWindow', {'markerId': markerId.value});
+ await _googleMapsFlutterPlatform.hideMarkerInfoWindow(markerId.value);
}
/// Returns `true` when the [InfoWindow] is showing, `false` otherwise.
@@ -275,14 +246,12 @@ class GoogleMapController {
/// * [hideMarkerInfoWindow] to hide the Info Window.
Future isMarkerInfoWindowShown(MarkerId markerId) async {
assert(markerId != null);
- return await channel.invokeMethod('markers#isInfoWindowShown',
- {'markerId': markerId.value});
+ return _googleMapsFlutterPlatform.isMarkerInfoWindowShown(markerId.value);
}
/// Returns the current zoom level of the map
Future getZoomLevel() async {
- final double zoomLevel =
- await channel.invokeMethod('map#getZoomLevel');
+ final double zoomLevel = await _googleMapsFlutterPlatform.getZoomLevel();
return zoomLevel;
}
}
diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart b/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart
index f6a413a82ffb..dff999aab10b 100644
--- a/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart
+++ b/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart
@@ -219,26 +219,11 @@ class _GoogleMapState extends State {
'polylinesToAdd': _serializePolylineSet(widget.polylines),
'circlesToAdd': _serializeCircleSet(widget.circles),
};
- if (defaultTargetPlatform == TargetPlatform.android) {
- return AndroidView(
- viewType: 'plugins.flutter.io/google_maps',
- onPlatformViewCreated: onPlatformViewCreated,
- gestureRecognizers: widget.gestureRecognizers,
- creationParams: creationParams,
- creationParamsCodec: const StandardMessageCodec(),
- );
- } else if (defaultTargetPlatform == TargetPlatform.iOS) {
- return UiKitView(
- viewType: 'plugins.flutter.io/google_maps',
- onPlatformViewCreated: onPlatformViewCreated,
- gestureRecognizers: widget.gestureRecognizers,
- creationParams: creationParams,
- creationParamsCodec: const StandardMessageCodec(),
- );
- }
-
- return Text(
- '$defaultTargetPlatform is not yet supported by the maps plugin');
+ return _googleMapsFlutterPlatform.buildView(
+ creationParams,
+ widget.gestureRecognizers,
+ onPlatformViewCreated,
+ );
}
@override
diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml
index 5ff3e3f22288..a050f31a5bb1 100644
--- a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml
+++ b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml
@@ -1,12 +1,16 @@
name: google_maps_flutter
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/google_maps_flutter
-version: 0.5.24+1
+version: 0.5.25
dependencies:
flutter:
sdk: flutter
flutter_plugin_android_lifecycle: ^1.0.0
+ google_maps_flutter_platform_interface:
+ path: ../google_maps_flutter_platform_interface
+ google_maps_flutter_web:
+ path: ../google_maps_flutter_web
dev_dependencies:
flutter_test:
@@ -27,6 +31,8 @@ flutter:
pluginClass: GoogleMapsPlugin
ios:
pluginClass: FLTGoogleMapsPlugin
+ web:
+ default_package: google_maps_flutter_web
environment:
diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md
new file mode 100644
index 000000000000..5442f6828779
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md
@@ -0,0 +1,17 @@
+## 1.0.0+4
+* Add init method and Move MethodChannel code to MethodChannelGoogleMapsFlutter
+
+## 1.0.0+3
+* Clean up format
+
+## 1.0.0+2
+
+* Add PlatformInterface methods according to GoogleMapsFlutter
+
+## 1.0.0+1
+
+* Update README
+
+## 1.0.0
+
+* Initial release.
diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/LICENSE b/packages/google_maps_flutter/google_maps_flutter_platform_interface/LICENSE
new file mode 100644
index 000000000000..8940a4be1b58
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/LICENSE
@@ -0,0 +1,27 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/README.md b/packages/google_maps_flutter/google_maps_flutter_platform_interface/README.md
new file mode 100644
index 000000000000..6489ba39cbd8
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/README.md
@@ -0,0 +1,26 @@
+# google_maps_flutter_platform_interface
+
+A common platform interface for the [`google_maps_flutter`][1] plugin.
+
+This interface allows platform-specific implementations of the `google_maps_flutter`
+plugin, as well as the plugin itself, to ensure they are supporting the
+same interface.
+
+# Usage
+
+To implement a new platform-specific implementation of `google_maps_flutter`, extend
+[`GoogleMapsFlutterPlatform`][2] with an implementation that performs the
+platform-specific behavior, and when you register your plugin, set the default
+`GoogleMapsFlutterPlatform` by calling
+`GoogleMapsFlutterPlatform.instance = MyPlatformGoogleMapsFlutter()`.
+
+# Note on breaking changes
+
+Strongly prefer non-breaking changes (such as adding a method to the interface)
+over breaking changes for this package.
+
+See https://flutter.dev/go/platform-interface-breaking-changes for a discussion
+on why a less-clean interface is preferable to a breaking change.
+
+[1]: ../google_maps_flutter
+[2]: lib/google_maps_flutter_platform_interface.dart
diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/google_maps_flutter_platform_interface.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/google_maps_flutter_platform_interface.dart
new file mode 100644
index 000000000000..5cbed251d78b
--- /dev/null
+++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/google_maps_flutter_platform_interface.dart
@@ -0,0 +1,227 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:ui';
+import 'package:flutter/widgets.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/foundation.dart';
+import 'package:flutter/gestures.dart';
+import 'package:meta/meta.dart';
+import 'package:plugin_platform_interface/plugin_platform_interface.dart';
+
+import 'method_channel_google_maps_flutter.dart';
+
+/// Exception when a map style is invalid or was unable to be set.
+///
+/// See also: `setStyle` on [GoogleMapController] for why this exception
+/// might be thrown.
+class MapStyleException implements Exception {
+ /// Default constructor for [MapStyleException].
+ const MapStyleException(this.cause);
+
+ /// The reason `GoogleMapController.setStyle` would throw this exception.
+ final String cause;
+}
+
+/// The interface that implementations of google_maps_flutter must implement.
+///
+/// Platform implementations should extend this class rather than implement it as `google_maps_flutter`
+/// does not consider newly added methods to be breaking changes. Extending this class
+/// (using `extends`) ensures that the subclass will get the default implementation, while
+/// platform implementations that `implements` this interface will be broken by newly added
+/// [GoogleMapsFlutterPlatform] methods.
+abstract class GoogleMapsFlutterPlatform extends PlatformInterface {
+ /// Constructs a GoogleMapsFlutterPlatform.
+ GoogleMapsFlutterPlatform() : super(token: _token);
+
+ static final Object _token = Object();
+
+ static GoogleMapsFlutterPlatform _instance =
+ MethodChannelGoogleMapsFlutter();
+
+ /// The default instance of [GoogleMapsFlutterPlatform] to use.
+ ///
+ /// Defaults to [MethodChannelGoogleMapsFlutter].
+ static GoogleMapsFlutterPlatform get instance => _instance;
+
+ /// Platform-specific plugins should set this with their own platform-specific
+ /// class that extends [GoogleMapsFlutterPlatform] when they register themselves.
+ static set instance(GoogleMapsFlutterPlatform instance) {
+ PlatformInterface.verifyToken(instance, _token);
+ _instance = instance;
+ }
+
+ /// /// Initializes the platform interface with [id].
+ ///
+ /// This method is called when the plugin is first initialized.
+ Future init(int id) {
+ throw UnimplementedError('init() has not been implemented.');
+ }
+
+ MethodChannel get channel {}
+
+ void setMethodCallHandler(dynamic call) {
+ throw UnimplementedError(
+ 'setMethodCallHandler() has not been implemented.');
+ }
+
+ /// Updates configuration options of the map user interface.
+ ///
+ /// Change listeners are notified once the update has been made on the
+ /// platform side.
+ ///
+ /// The returned [Future] completes after listeners have been notified.
+ Future updateMapOptions(Map optionsUpdate) {
+ throw UnimplementedError('updateMapOptions() has not been implemented.');
+ }
+
+ /// Updates marker configuration.
+ ///
+ /// Change listeners are notified once the update has been made on the
+ /// platform side.
+ ///
+ /// The returned [Future] completes after listeners have been notified.
+ Future updateMarkers(Map markerUpdates) {
+ throw UnimplementedError('updateMarkers() has not been implemented.');
+ }
+
+ /// Updates polygon configuration.
+ ///
+ /// Change listeners are notified once the update has been made on the
+ /// platform side.
+ ///
+ /// The returned [Future] completes after listeners have been notified.
+ Future updatePolygons(Map polygonUpdates) {
+ throw UnimplementedError('updatePolygons() has not been implemented.');
+ }
+
+ /// Updates polyline configuration.
+ ///
+ /// Change listeners are notified once the update has been made on the
+ /// platform side.
+ ///
+ /// The returned [Future] completes after listeners have been notified.
+ Future updatePolylines(Map polylineUpdates) {
+ throw UnimplementedError('updatePolylines() has not been implemented.');
+ }
+
+ /// Updates circle configuration.
+ ///
+ /// Change listeners are notified once the update has been made on the
+ /// platform side.
+ ///
+ /// The returned [Future] completes after listeners have been notified.
+ Future updateCircles(Map circleUpdates) {
+ throw UnimplementedError('updateCircles() has not been implemented.');
+ }
+
+ /// Starts an animated change of the map camera position.
+ ///
+ /// The returned [Future] completes after the change has been started on the
+ /// platform side.
+ Future animateCamera(dynamic cameraUpdate) {
+ throw UnimplementedError('animateCamera() has not been implemented.');
+ }
+
+ /// Changes the map camera position.
+ ///
+ /// The returned [Future] completes after the change has been made on the
+ /// platform side.
+ Future moveCamera(dynamic cameraUpdate) {
+ throw UnimplementedError('moveCamera() has not been implemented.');
+ }
+
+ /// Sets the styling of the base map.
+ ///
+ /// Set to `null` to clear any previous custom styling.
+ ///
+ /// If problems were detected with the [mapStyle], including un-parsable
+ /// styling JSON, unrecognized feature type, unrecognized element type, or
+ /// invalid styler keys: [MapStyleException] is thrown and the current
+ /// style is left unchanged.
+ ///
+ /// The style string can be generated using [map style tool](https://mapstyle.withgoogle.com/).
+ /// Also, refer [iOS](https://developers.google.com/maps/documentation/ios-sdk/style-reference)
+ /// and [Android](https://developers.google.com/maps/documentation/android-sdk/style-reference)
+ /// style reference for more information regarding the supported styles.
+ Future setMapStyle(String mapStyle) {
+ throw UnimplementedError('setMapStyle() has not been implemented.');
+ }
+
+ /// Return [Map] defining the region that is visible in a map.
+ Future