diff --git a/CHANGELOG.md b/CHANGELOG.md
index f793020f..3322963f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog
+## 1.5.0
+
+* Adds Swift Package Manager support (CocoaPods is still supported). Removes the Objective-C registration shim; the plugin class is now the Swift class `AppleMapsFlutterPlugin`. Requires Flutter 3.41+.
+* Raises the minimum iOS version to 13.0.
+
## 1.4.0
* Flutter 3.27.1 compatibility, replace `ui.hash*` with `Object.hash*
diff --git a/example/ios/.gitignore b/example/ios/.gitignore
index e96ef602..151026b9 100644
--- a/example/ios/.gitignore
+++ b/example/ios/.gitignore
@@ -18,6 +18,7 @@ Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
+Flutter/ephemeral/
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist
index 8d4492f9..391a902b 100644
--- a/example/ios/Flutter/AppFrameworkInfo.plist
+++ b/example/ios/Flutter/AppFrameworkInfo.plist
@@ -20,7 +20,5 @@
????
CFBundleVersion
1.0
- MinimumOSVersion
- 9.0
diff --git a/example/ios/Podfile b/example/ios/Podfile
index 1e8c3c90..f17bddc9 100644
--- a/example/ios/Podfile
+++ b/example/ios/Podfile
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
-# platform :ios, '9.0'
+platform :ios, '15.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
index eff76023..72af206b 100644
--- a/example/ios/Podfile.lock
+++ b/example/ios/Podfile.lock
@@ -1,22 +1,16 @@
PODS:
- - apple_maps_flutter (0.0.1):
- - Flutter
- Flutter (1.0.0)
DEPENDENCIES:
- - apple_maps_flutter (from `.symlinks/plugins/apple_maps_flutter/ios`)
- Flutter (from `Flutter`)
EXTERNAL SOURCES:
- apple_maps_flutter:
- :path: ".symlinks/plugins/apple_maps_flutter/ios"
Flutter:
:path: Flutter
SPEC CHECKSUMS:
- apple_maps_flutter: c59725efea39e13e703cde52a1d2b14866ad68a8
- Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
+ Flutter: 71a624a5bc0c04062bf19101d501e466baf2fb47
-PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
+PODFILE CHECKSUM: 57c8aed26fba39d3ec9424816221f294a07c58eb
-COCOAPODS: 1.11.3
+COCOAPODS: 1.16.2
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index b74440f9..1125509a 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -3,13 +3,14 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 50;
+ objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
+ 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
7E3ED54974DCE25524E09722 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AB21804E11E2CF6CAB18B54 /* Pods_Runner.framework */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
@@ -36,6 +37,9 @@
5AB21804E11E2CF6CAB18B54 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
+ 784666492D4C4C64000A1A5F /* FlutterFramework */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterFramework; path = Flutter/ephemeral/Packages/.packages/FlutterFramework; sourceTree = ""; };
+ 78DABEA22ED26510000E7860 /* apple_maps_flutter */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = apple_maps_flutter; path = ../../ios/apple_maps_flutter; sourceTree = ""; };
+ 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
@@ -54,6 +58,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
7E3ED54974DCE25524E09722 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -75,6 +80,9 @@
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
+ 78DABEA22ED26510000E7860 /* apple_maps_flutter */,
+ 784666492D4C4C64000A1A5F /* FlutterFramework */,
+ 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
@@ -139,13 +147,15 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
- A76139E19E24CB98ED0622B3 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = Runner;
+ packageProductDependencies = (
+ 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
+ );
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
@@ -156,7 +166,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 1300;
+ LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
@@ -174,6 +184,9 @@
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
+ packageReferences = (
+ 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */,
+ );
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
@@ -200,10 +213,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
@@ -236,6 +251,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -248,23 +264,6 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
- A76139E19E24CB98ED0622B3 /* [CP] Embed Pods Frameworks */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputFileListPaths = (
- "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
- );
- name = "[CP] Embed Pods Frameworks";
- outputFileListPaths = (
- "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
- showEnvVarsInLog = 0;
- };
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -340,7 +339,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -358,7 +357,10 @@
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
PRODUCT_BUNDLE_IDENTIFIER = de.luisthein.appleMapsFlutterExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -414,7 +416,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -463,7 +465,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -482,7 +484,10 @@
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
PRODUCT_BUNDLE_IDENTIFIER = de.luisthein.appleMapsFlutterExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -501,7 +506,10 @@
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
PRODUCT_BUNDLE_IDENTIFIER = de.luisthein.appleMapsFlutterExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -534,6 +542,20 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
+
+/* Begin XCLocalSwiftPackageReference section */
+ 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = {
+ isa = XCLocalSwiftPackageReference;
+ relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
+ };
+/* End XCLocalSwiftPackageReference section */
+
+/* Begin XCSwiftPackageProductDependency section */
+ 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
+ isa = XCSwiftPackageProductDependency;
+ productName = FlutterGeneratedPluginSwiftPackage;
+ };
+/* End XCSwiftPackageProductDependency section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index 3db53b6e..0bd6d422 100644
--- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -1,10 +1,28 @@
+
+
+
+
+
+
+
+
+
+
@@ -45,11 +64,13 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
+ enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift
index 70693e4a..c30b367e 100644
--- a/example/ios/Runner/AppDelegate.swift
+++ b/example/ios/Runner/AppDelegate.swift
@@ -1,13 +1,16 @@
-import UIKit
import Flutter
+import UIKit
-@UIApplicationMain
-@objc class AppDelegate: FlutterAppDelegate {
+@main
+@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
- GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
+
+ func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
+ GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
+ }
}
diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist
index 6f300aae..7d9e6577 100644
--- a/example/ios/Runner/Info.plist
+++ b/example/ios/Runner/Info.plist
@@ -2,6 +2,8 @@
+ CADisableMinimumFrameDurationOnPhone
+
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleExecutable
@@ -24,6 +26,29 @@
NSLocationWhenInUseUsageDescription
This App needs permission to access your location in order to show it on the map.
+ UIApplicationSceneManifest
+
+ UIApplicationSupportsMultipleScenes
+
+ UISceneConfigurations
+
+ UIWindowSceneSessionRoleApplication
+
+
+ UISceneClassName
+ UIWindowScene
+ UISceneConfigurationName
+ flutter
+ UISceneDelegateClassName
+ FlutterSceneDelegate
+ UISceneStoryboardFile
+ Main
+
+
+
+
+ UIApplicationSupportsIndirectInputEvents
+
UILaunchStoryboardName
LaunchScreen
UIMainStoryboardFile
@@ -43,7 +68,5 @@
UIViewControllerBasedStatusBarAppearance
- CADisableMinimumFrameDurationOnPhone
-
diff --git a/example/lib/animate_camera.dart b/example/lib/animate_camera.dart
index 07d97827..b87722c1 100644
--- a/example/lib/animate_camera.dart
+++ b/example/lib/animate_camera.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';
import 'page.dart';
diff --git a/example/lib/annotation_icons.dart b/example/lib/annotation_icons.dart
index 62821287..bee89cc2 100644
--- a/example/lib/annotation_icons.dart
+++ b/example/lib/annotation_icons.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';
import 'page.dart';
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 0cb13997..a33ac208 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -17,7 +17,7 @@ import 'package:apple_maps_flutter_example/place_polygon.dart';
import 'package:apple_maps_flutter_example/place_polyline.dart';
import 'package:apple_maps_flutter_example/scrolling_map.dart';
import 'package:apple_maps_flutter_example/snapshot.dart';
-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';
final List _allPages = [
MapUiPage(),
diff --git a/example/lib/map_click.dart b/example/lib/map_click.dart
index 49510d4f..fe572f70 100644
--- a/example/lib/map_click.dart
+++ b/example/lib/map_click.dart
@@ -3,8 +3,7 @@
// found in the LICENSE file.
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
+import 'package:material_ui/material_ui.dart';
import 'page.dart';
diff --git a/example/lib/map_coordinates.dart b/example/lib/map_coordinates.dart
index de28d54d..0f996027 100644
--- a/example/lib/map_coordinates.dart
+++ b/example/lib/map_coordinates.dart
@@ -3,8 +3,7 @@
// found in the LICENSE file.
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
+import 'package:material_ui/material_ui.dart';
import 'page.dart';
diff --git a/example/lib/map_ui.dart b/example/lib/map_ui.dart
index 35d81194..99817788 100644
--- a/example/lib/map_ui.dart
+++ b/example/lib/map_ui.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';
import 'page.dart';
diff --git a/example/lib/map_update.dart b/example/lib/map_update.dart
index da7d2dcd..37517fbd 100644
--- a/example/lib/map_update.dart
+++ b/example/lib/map_update.dart
@@ -1,6 +1,6 @@
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
import 'package:apple_maps_flutter_example/page.dart';
-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';
class MapUpdatePage extends ExamplePage {
MapUpdatePage() : super(const Icon(Icons.refresh), 'Update Map');
diff --git a/example/lib/move_camera.dart b/example/lib/move_camera.dart
index 49c63b85..fbac1a17 100644
--- a/example/lib/move_camera.dart
+++ b/example/lib/move_camera.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';
import 'page.dart';
diff --git a/example/lib/padding.dart b/example/lib/padding.dart
index 0c71f92a..0cc3d081 100644
--- a/example/lib/padding.dart
+++ b/example/lib/padding.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';
import 'page.dart';
diff --git a/example/lib/page.dart b/example/lib/page.dart
index ab895ac4..36ac90a7 100644
--- a/example/lib/page.dart
+++ b/example/lib/page.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
abstract class ExamplePage extends StatelessWidget {
const ExamplePage(this.leading, this.title);
diff --git a/example/lib/place_annotation.dart b/example/lib/place_annotation.dart
index 3a3e28b6..a1099ef7 100644
--- a/example/lib/place_annotation.dart
+++ b/example/lib/place_annotation.dart
@@ -4,12 +4,10 @@
import 'dart:async';
import 'dart:math';
-import 'dart:typed_data';
-import 'dart:ui';
import 'dart:ui' as ui;
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';
import 'package:flutter/services.dart';
import 'page.dart';
diff --git a/example/lib/place_circle.dart b/example/lib/place_circle.dart
index c5cfe671..c1283f97 100644
--- a/example/lib/place_circle.dart
+++ b/example/lib/place_circle.dart
@@ -7,7 +7,7 @@ import 'dart:typed_data';
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
// ignore_for_file: public_member_api_docs
-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';
import 'page.dart';
diff --git a/example/lib/place_polygon.dart b/example/lib/place_polygon.dart
index fee74d72..00eb0e9b 100644
--- a/example/lib/place_polygon.dart
+++ b/example/lib/place_polygon.dart
@@ -7,7 +7,7 @@ import 'dart:typed_data';
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
// ignore_for_file: public_member_api_docs
-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';
import 'page.dart';
diff --git a/example/lib/place_polyline.dart b/example/lib/place_polyline.dart
index 9ad092a6..6290d921 100644
--- a/example/lib/place_polyline.dart
+++ b/example/lib/place_polyline.dart
@@ -5,7 +5,7 @@
import 'dart:typed_data';
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';
import 'page.dart';
diff --git a/example/lib/scrolling_map.dart b/example/lib/scrolling_map.dart
index 4b6143ac..138c5abc 100644
--- a/example/lib/scrolling_map.dart
+++ b/example/lib/scrolling_map.dart
@@ -7,8 +7,7 @@ import 'package:apple_maps_flutter/apple_maps_flutter.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter/rendering.dart';
+import 'package:material_ui/material_ui.dart';
import 'page.dart';
diff --git a/example/lib/snapshot.dart b/example/lib/snapshot.dart
index b16f8083..3cbc5350 100644
--- a/example/lib/snapshot.dart
+++ b/example/lib/snapshot.dart
@@ -7,7 +7,7 @@
import 'dart:typed_data';
import 'package:apple_maps_flutter_example/page.dart';
-import 'package:flutter/material.dart';
+import 'package:material_ui/material_ui.dart';
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
const CameraPosition _kInitialPosition =
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 49d247a9..8cbc289d 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -18,11 +18,12 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
- sdk: ">=2.12.0 <3.0.0"
+ sdk: ">=3.0.0 <4.0.0"
dependencies:
flutter:
sdk: flutter
+ material_ui: ^1.11.0
# The following adds the Cupertino Icons font to your application.
diff --git a/example/test_driver/apple_maps.dart b/example/test_driver/apple_maps.dart
index 95ecebc0..63883e0c 100644
--- a/example/test_driver/apple_maps.dart
+++ b/example/test_driver/apple_maps.dart
@@ -20,7 +20,7 @@ void main() {
final Completer allTestsCompleter = Completer();
enableFlutterDriverExtension(handler: (_) => allTestsCompleter.future);
- tearDownAll(() => allTestsCompleter.complete(null));
+ tearDownAll(() => allTestsCompleter.complete(''));
test('testCompassToggle', () async {
final Key key = GlobalKey();
@@ -43,6 +43,7 @@ void main() {
));
final AppleMapInspector inspector = await inspectorCompleter.future;
+ await waitForNativeLayout();
bool compassEnabled = (await inspector.isCompassEnabled())!;
expect(compassEnabled, false);
@@ -86,6 +87,7 @@ void main() {
));
final AppleMapInspector inspector = await inspectorCompleter.future;
+ await waitForNativeLayout();
MinMaxZoomPreference zoomLevel = await inspector.getMinMaxZoomLevels();
expect(zoomLevel, equals(initialZoomLevel));
@@ -126,6 +128,7 @@ void main() {
));
final AppleMapInspector inspector = await inspectorCompleter.future;
+ await waitForNativeLayout();
bool zoomGesturesEnabled = (await inspector.isZoomGesturesEnabled())!;
expect(zoomGesturesEnabled, false);
@@ -166,6 +169,7 @@ void main() {
));
final AppleMapInspector inspector = await inspectorCompleter.future;
+ await waitForNativeLayout();
bool rotateGesturesEnabled = (await inspector.isRotateGesturesEnabled())!;
expect(rotateGesturesEnabled, false);
@@ -206,6 +210,7 @@ void main() {
));
final AppleMapInspector inspector = await inspectorCompleter.future;
+ await waitForNativeLayout();
bool pitchGesturesEnabled = (await inspector.isPitchGesturesEnabled())!;
expect(pitchGesturesEnabled, false);
@@ -246,6 +251,7 @@ void main() {
));
final AppleMapInspector inspector = await inspectorCompleter.future;
+ await waitForNativeLayout();
bool scrollGesturesEnabled = (await inspector.isScrollGesturesEnabled())!;
expect(scrollGesturesEnabled, false);
@@ -350,6 +356,7 @@ void main() {
));
final AppleMapInspector inspector = await inspectorCompleter.future;
+ await waitForNativeLayout();
bool myLocationButtonEnabled =
(await inspector.isMyLocationButtonEnabled())!;
expect(myLocationButtonEnabled, true);
@@ -393,6 +400,7 @@ void main() {
));
final AppleMapInspector inspector = await inspectorCompleter.future;
+ await waitForNativeLayout();
final bool myLocationButtonEnabled =
(await inspector.isMyLocationButtonEnabled())!;
expect(myLocationButtonEnabled, false);
@@ -420,8 +428,9 @@ void main() {
));
final AppleMapInspector inspector = await inspectorCompleter.future;
+ await waitForNativeLayout();
final bool myLocationButtonEnabled =
(await inspector.isMyLocationButtonEnabled())!;
- expect(myLocationButtonEnabled, false);
+ expect(myLocationButtonEnabled, true);
});
}
diff --git a/example/test_driver/test_widgets.dart b/example/test_driver/test_widgets.dart
index d2c27fd9..1451a186 100644
--- a/example/test_driver/test_widgets.dart
+++ b/example/test_driver/test_widgets.dart
@@ -8,5 +8,13 @@ import 'package:flutter/widgets.dart';
Future pumpWidget(Widget widget) {
runApp(widget);
- return WidgetsBinding.instance!.endOfFrame;
+ return WidgetsBinding.instance.endOfFrame;
+}
+
+/// The native map applies its creation options in `layoutSubviews`, which runs
+/// after `onMapCreated`. Waiting for rendered frames lets that layout happen
+/// before a test reads native state.
+Future waitForNativeLayout() async {
+ await WidgetsBinding.instance.endOfFrame;
+ await WidgetsBinding.instance.endOfFrame;
}
diff --git a/ios/.gitignore b/ios/.gitignore
index 710ec6cf..62364b2a 100644
--- a/ios/.gitignore
+++ b/ios/.gitignore
@@ -34,3 +34,6 @@ Icon?
.tags*
/Flutter/Generated.xcconfig
+
+.build/
+.swiftpm/
diff --git a/ios/Assets/.gitkeep b/ios/Assets/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/ios/Classes/AppleMapsFlutterPlugin.h b/ios/Classes/AppleMapsFlutterPlugin.h
deleted file mode 100644
index 7ca9bfbc..00000000
--- a/ios/Classes/AppleMapsFlutterPlugin.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#import
-
-@interface AppleMapsFlutterPlugin : NSObject
-@end
diff --git a/ios/Classes/AppleMapsFlutterPlugin.m b/ios/Classes/AppleMapsFlutterPlugin.m
deleted file mode 100644
index 13164091..00000000
--- a/ios/Classes/AppleMapsFlutterPlugin.m
+++ /dev/null
@@ -1,8 +0,0 @@
-#import "AppleMapsFlutterPlugin.h"
-#import
-
-@implementation AppleMapsFlutterPlugin
-+ (void)registerWithRegistrar:(NSObject*)registrar {
- [SwiftAppleMapsFlutterPlugin registerWithRegistrar:registrar];
-}
-@end
diff --git a/ios/apple_maps_flutter.podspec b/ios/apple_maps_flutter.podspec
index 1bad1794..8b1008da 100644
--- a/ios/apple_maps_flutter.podspec
+++ b/ios/apple_maps_flutter.podspec
@@ -4,18 +4,17 @@
Pod::Spec.new do |s|
s.name = 'apple_maps_flutter'
s.version = '0.0.1'
- s.summary = 'A new flutter plugin project.'
+ s.summary = 'Apple Maps widget for Flutter.'
s.description = <<-DESC
-A new flutter plugin project.
+This plugin uses the Flutter platform view to display an Apple Maps widget.
DESC
s.homepage = 'http://example.com'
- s.license = { :file => '../LICENSE' }
+ s.license = { :type => 'BSD-2-Clause', :file => '../LICENSE' }
s.author = { 'Your Company' => 'email@example.com' }
- s.source = { :path => '.' }
- s.source_files = 'Classes/**/*'
- s.public_header_files = 'Classes/**/*.h'
+ s.source = { :http => 'https://github.com/LuisThein/apple_maps_flutter' }
+ s.source_files = 'apple_maps_flutter/Sources/apple_maps_flutter/**/*.swift'
s.dependency 'Flutter'
- s.ios.deployment_target = '9.0'
- s.swift_version = '5.0'
+ s.ios.deployment_target = '13.0'
+ s.swift_version = '5.9'
end
diff --git a/ios/apple_maps_flutter/Package.swift b/ios/apple_maps_flutter/Package.swift
new file mode 100644
index 00000000..7e9c79d3
--- /dev/null
+++ b/ios/apple_maps_flutter/Package.swift
@@ -0,0 +1,25 @@
+// swift-tools-version: 5.9
+// The swift-tools-version declares the minimum version of Swift required to build this package.
+
+import PackageDescription
+
+let package = Package(
+ name: "apple_maps_flutter",
+ platforms: [
+ .iOS("13.0")
+ ],
+ products: [
+ .library(name: "apple-maps-flutter", targets: ["apple_maps_flutter"])
+ ],
+ dependencies: [
+ .package(name: "FlutterFramework", path: "../FlutterFramework")
+ ],
+ targets: [
+ .target(
+ name: "apple_maps_flutter",
+ dependencies: [
+ .product(name: "FlutterFramework", package: "FlutterFramework")
+ ]
+ )
+ ]
+)
diff --git a/ios/Classes/Annotations/AnnotationController.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Annotations/AnnotationController.swift
similarity index 100%
rename from ios/Classes/Annotations/AnnotationController.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Annotations/AnnotationController.swift
diff --git a/ios/Classes/Annotations/AnnotationDelegate.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Annotations/AnnotationDelegate.swift
similarity index 100%
rename from ios/Classes/Annotations/AnnotationDelegate.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Annotations/AnnotationDelegate.swift
diff --git a/ios/Classes/Annotations/AnnotationIcon.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Annotations/AnnotationIcon.swift
similarity index 98%
rename from ios/Classes/Annotations/AnnotationIcon.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Annotations/AnnotationIcon.swift
index 85b04f7c..82517b9d 100644
--- a/ios/Classes/Annotations/AnnotationIcon.swift
+++ b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Annotations/AnnotationIcon.swift
@@ -6,6 +6,8 @@
//
import Foundation
+import Flutter
+import UIKit
enum IconType {
case PIN, MARKER, CUSTOM_FROM_ASSET, CUSTOM_FROM_BYTES
diff --git a/ios/Classes/Annotations/FlutterAnnotation.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Annotations/FlutterAnnotation.swift
similarity index 99%
rename from ios/Classes/Annotations/FlutterAnnotation.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Annotations/FlutterAnnotation.swift
index 5e29e799..1c012e6d 100644
--- a/ios/Classes/Annotations/FlutterAnnotation.swift
+++ b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Annotations/FlutterAnnotation.swift
@@ -6,6 +6,7 @@
//
import Foundation
+import Flutter
import MapKit
class FlutterAnnotation: NSObject, MKAnnotation {
diff --git a/ios/Classes/Annotations/FlutterAnnotationView.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Annotations/FlutterAnnotationView.swift
similarity index 100%
rename from ios/Classes/Annotations/FlutterAnnotationView.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Annotations/FlutterAnnotationView.swift
diff --git a/ios/Classes/SwiftAppleMapsFlutterPlugin.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/AppleMapsFlutterPlugin.swift
similarity index 75%
rename from ios/Classes/SwiftAppleMapsFlutterPlugin.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/AppleMapsFlutterPlugin.swift
index b14df79e..0354289f 100644
--- a/ios/Classes/SwiftAppleMapsFlutterPlugin.swift
+++ b/ios/apple_maps_flutter/Sources/apple_maps_flutter/AppleMapsFlutterPlugin.swift
@@ -1,7 +1,7 @@
import Flutter
import UIKit
-public class SwiftAppleMapsFlutterPlugin: NSObject, FlutterPlugin {
+public class AppleMapsFlutterPlugin: NSObject, FlutterPlugin {
var factory: AppleMapViewFactory
public init(with registrar: FlutterPluginRegistrar) {
factory = AppleMapViewFactory(withRegistrar: registrar)
@@ -9,6 +9,6 @@ public class SwiftAppleMapsFlutterPlugin: NSObject, FlutterPlugin {
}
public static func register(with registrar: FlutterPluginRegistrar) {
- registrar.addApplicationDelegate(SwiftAppleMapsFlutterPlugin(with: registrar))
+ registrar.addApplicationDelegate(AppleMapsFlutterPlugin(with: registrar))
}
}
diff --git a/ios/Classes/MapView/AppleMapController.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/MapView/AppleMapController.swift
similarity index 99%
rename from ios/Classes/MapView/AppleMapController.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/MapView/AppleMapController.swift
index 85e7a981..c72233c9 100644
--- a/ios/Classes/MapView/AppleMapController.swift
+++ b/ios/apple_maps_flutter/Sources/apple_maps_flutter/MapView/AppleMapController.swift
@@ -6,6 +6,7 @@
//
import Foundation
+import Flutter
import MapKit
public class AppleMapController: NSObject, FlutterPlatformView {
diff --git a/ios/Classes/MapView/AppleMapsViewFactory.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/MapView/AppleMapsViewFactory.swift
similarity index 98%
rename from ios/Classes/MapView/AppleMapsViewFactory.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/MapView/AppleMapsViewFactory.swift
index 2d01ad6e..4d3ba38d 100644
--- a/ios/Classes/MapView/AppleMapsViewFactory.swift
+++ b/ios/apple_maps_flutter/Sources/apple_maps_flutter/MapView/AppleMapsViewFactory.swift
@@ -6,6 +6,7 @@
//
import Foundation
+import Flutter
public class AppleMapViewFactory: NSObject, FlutterPlatformViewFactory {
diff --git a/ios/Classes/MapView/FlutterMapView.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/MapView/FlutterMapView.swift
similarity index 99%
rename from ios/Classes/MapView/FlutterMapView.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/MapView/FlutterMapView.swift
index 1e733edc..ec1a4dd9 100644
--- a/ios/Classes/MapView/FlutterMapView.swift
+++ b/ios/apple_maps_flutter/Sources/apple_maps_flutter/MapView/FlutterMapView.swift
@@ -6,6 +6,7 @@
//
import Foundation
+import Flutter
import MapKit
import CoreLocation
diff --git a/ios/Classes/MapView/MapViewExtension.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/MapView/MapViewExtension.swift
similarity index 100%
rename from ios/Classes/MapView/MapViewExtension.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/MapView/MapViewExtension.swift
diff --git a/ios/Classes/Overlays/FlutterOverlay.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/FlutterOverlay.swift
similarity index 100%
rename from ios/Classes/Overlays/FlutterOverlay.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/FlutterOverlay.swift
diff --git a/ios/Classes/Overlays/Polygons/FlutterPolygon.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/Polygons/FlutterPolygon.swift
similarity index 100%
rename from ios/Classes/Overlays/Polygons/FlutterPolygon.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/Polygons/FlutterPolygon.swift
diff --git a/ios/Classes/Overlays/Polygons/PolygonController.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/Polygons/PolygonController.swift
similarity index 100%
rename from ios/Classes/Overlays/Polygons/PolygonController.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/Polygons/PolygonController.swift
diff --git a/ios/Classes/Overlays/Polygons/PolygonDelegate.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/Polygons/PolygonDelegate.swift
similarity index 100%
rename from ios/Classes/Overlays/Polygons/PolygonDelegate.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/Polygons/PolygonDelegate.swift
diff --git a/ios/Classes/Overlays/Polylines/FlutterPolyline.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/Polylines/FlutterPolyline.swift
similarity index 100%
rename from ios/Classes/Overlays/Polylines/FlutterPolyline.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/Polylines/FlutterPolyline.swift
diff --git a/ios/Classes/Overlays/Polylines/PolylineController.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/Polylines/PolylineController.swift
similarity index 100%
rename from ios/Classes/Overlays/Polylines/PolylineController.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/Polylines/PolylineController.swift
diff --git a/ios/Classes/Overlays/Polylines/PolylineDelegate.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/Polylines/PolylineDelegate.swift
similarity index 100%
rename from ios/Classes/Overlays/Polylines/PolylineDelegate.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/Polylines/PolylineDelegate.swift
diff --git a/ios/Classes/Overlays/circles/CircleController.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/circles/CircleController.swift
similarity index 100%
rename from ios/Classes/Overlays/circles/CircleController.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/circles/CircleController.swift
diff --git a/ios/Classes/Overlays/circles/CircleDelegate.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/circles/CircleDelegate.swift
similarity index 100%
rename from ios/Classes/Overlays/circles/CircleDelegate.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/circles/CircleDelegate.swift
diff --git a/ios/Classes/Overlays/circles/FlutterCircle.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/circles/FlutterCircle.swift
similarity index 100%
rename from ios/Classes/Overlays/circles/FlutterCircle.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Overlays/circles/FlutterCircle.swift
diff --git a/ios/Classes/Utils/JsonConversion.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Utils/JsonConversion.swift
similarity index 100%
rename from ios/Classes/Utils/JsonConversion.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Utils/JsonConversion.swift
diff --git a/ios/Classes/Utils/TouchHandler.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Utils/TouchHandler.swift
similarity index 99%
rename from ios/Classes/Utils/TouchHandler.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Utils/TouchHandler.swift
index e14644f8..923371a5 100644
--- a/ios/Classes/Utils/TouchHandler.swift
+++ b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Utils/TouchHandler.swift
@@ -6,6 +6,7 @@
//
import Foundation
+import Flutter
import MapKit
class TouchHandler {
diff --git a/ios/Classes/Utils/Utils.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/Utils/Utils.swift
similarity index 100%
rename from ios/Classes/Utils/Utils.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/Utils/Utils.swift
diff --git a/ios/Classes/models/SnapshotOptions.swift b/ios/apple_maps_flutter/Sources/apple_maps_flutter/models/SnapshotOptions.swift
similarity index 100%
rename from ios/Classes/models/SnapshotOptions.swift
rename to ios/apple_maps_flutter/Sources/apple_maps_flutter/models/SnapshotOptions.swift
diff --git a/lib/apple_maps_flutter.dart b/lib/apple_maps_flutter.dart
index dccdfc81..bdbb6e8e 100644
--- a/lib/apple_maps_flutter.dart
+++ b/lib/apple_maps_flutter.dart
@@ -5,13 +5,10 @@
library apple_maps_flutter;
import 'dart:async';
-import 'dart:typed_data';
-import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter/rendering.dart';
+import 'package:flutter/widgets.dart';
import 'package:flutter/services.dart';
part 'src/annotation.dart';
diff --git a/lib/src/annotation.dart b/lib/src/annotation.dart
index 71b6b12d..6804f0f1 100644
--- a/lib/src/annotation.dart
+++ b/lib/src/annotation.dart
@@ -130,6 +130,9 @@ class AnnotationId {
/// the map's surface; that is, it will not necessarily change orientation
/// due to map rotations, tilting, or zooming.
@immutable
+// zIndex is updated in place by onAnnotationZIndexChanged (apple_map.dart), so
+// making it final would change behavior.
+// ignore: must_be_immutable
class Annotation {
/// Creates a set of annotation configuration options.
///
diff --git a/lib/src/camera.dart b/lib/src/camera.dart
index fb842af1..768e225e 100644
--- a/lib/src/camera.dart
+++ b/lib/src/camera.dart
@@ -62,10 +62,10 @@ class CameraPosition {
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) return true;
if (runtimeType != other.runtimeType) return false;
- final CameraPosition typedOther = other;
+ final CameraPosition typedOther = other as CameraPosition;
return heading == typedOther.heading &&
target == typedOther.target &&
pitch == typedOther.pitch &&
diff --git a/lib/src/circle.dart b/lib/src/circle.dart
index de4c4701..1ef725fb 100644
--- a/lib/src/circle.dart
+++ b/lib/src/circle.dart
@@ -39,10 +39,10 @@ class Circle {
const Circle({
required this.circleId,
this.consumeTapEvents = false,
- this.fillColor = Colors.transparent,
+ this.fillColor = const Color(0x00000000),
this.center = const LatLng(0.0, 0.0),
this.radius = 0,
- this.strokeColor = Colors.black,
+ this.strokeColor = const Color(0xFF000000),
this.strokeWidth = 10,
this.visible = true,
this.zIndex,
@@ -130,10 +130,10 @@ class Circle {
addIfPresent('circleId', circleId.value);
addIfPresent('consumeTapEvents', consumeTapEvents);
- addIfPresent('fillColor', fillColor.value);
+ addIfPresent('fillColor', fillColor.toARGB32());
addIfPresent('center', center._toJson());
addIfPresent('radius', radius);
- addIfPresent('strokeColor', strokeColor.value);
+ addIfPresent('strokeColor', strokeColor.toARGB32());
addIfPresent('strokeWidth', strokeWidth);
addIfPresent('visible', visible);
addIfPresent('zIndex', zIndex);
diff --git a/lib/src/polygon.dart b/lib/src/polygon.dart
index 3540d59e..7792c098 100644
--- a/lib/src/polygon.dart
+++ b/lib/src/polygon.dart
@@ -39,9 +39,9 @@ class Polygon {
const Polygon({
required this.polygonId,
this.consumeTapEvents = false,
- this.fillColor = Colors.black,
+ this.fillColor = const Color(0xFF000000),
this.points = const [],
- this.strokeColor = Colors.black,
+ this.strokeColor = const Color(0xFF000000),
this.strokeWidth = 10,
this.visible = true,
this.zIndex,
@@ -128,8 +128,8 @@ class Polygon {
addIfPresent('polygonId', polygonId.value);
addIfPresent('consumeTapEvents', consumeTapEvents);
- addIfPresent('fillColor', fillColor.value);
- addIfPresent('strokeColor', strokeColor.value);
+ addIfPresent('fillColor', fillColor.toARGB32());
+ addIfPresent('strokeColor', strokeColor.toARGB32());
addIfPresent('strokeWidth', strokeWidth);
addIfPresent('visible', visible);
addIfPresent('zIndex', zIndex);
diff --git a/lib/src/polyline.dart b/lib/src/polyline.dart
index a73ed349..393fb669 100644
--- a/lib/src/polyline.dart
+++ b/lib/src/polyline.dart
@@ -37,7 +37,7 @@ class Polyline {
const Polyline({
required this.polylineId,
this.consumeTapEvents = false,
- this.color = Colors.black,
+ this.color = const Color(0xFF000000),
this.polylineCap = Cap.buttCap,
this.jointType = JointType.round,
this.points = const [],
@@ -155,7 +155,7 @@ class Polyline {
addIfPresent('polylineId', polylineId.value);
addIfPresent('consumeTapEvents', consumeTapEvents);
- addIfPresent('color', color.value);
+ addIfPresent('color', color.toARGB32());
addIfPresent('polylineCap', polylineCap._toJson());
addIfPresent('jointType', jointType.value);
addIfPresent('visible', visible);
diff --git a/lib/src/snapshot_options.dart b/lib/src/snapshot_options.dart
index dbfa8547..df3db181 100644
--- a/lib/src/snapshot_options.dart
+++ b/lib/src/snapshot_options.dart
@@ -34,10 +34,10 @@ class SnapshotOptions {
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) return true;
if (runtimeType != other.runtimeType) return false;
- final SnapshotOptions typedOther = other;
+ final SnapshotOptions typedOther = other as SnapshotOptions;
return showBuildings == typedOther.showBuildings &&
showPointsOfInterest == typedOther.showPointsOfInterest &&
showAnnotations == typedOther.showAnnotations &&
diff --git a/lib/src/ui.dart b/lib/src/ui.dart
index 71c00a5f..7d8e3891 100644
--- a/lib/src/ui.dart
+++ b/lib/src/ui.dart
@@ -45,10 +45,10 @@ class CameraTargetBounds {
static const CameraTargetBounds unbounded = CameraTargetBounds(null);
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) return true;
if (runtimeType != other.runtimeType) return false;
- final CameraTargetBounds typedOther = other;
+ final CameraTargetBounds typedOther = other as CameraTargetBounds;
return bounds == typedOther.bounds;
}
@@ -78,10 +78,10 @@ class MinMaxZoomPreference {
dynamic _toJson() => [minZoom, maxZoom];
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) return true;
if (runtimeType != other.runtimeType) return false;
- final MinMaxZoomPreference typedOther = other;
+ final MinMaxZoomPreference typedOther = other as MinMaxZoomPreference;
return minZoom == typedOther.minZoom && maxZoom == typedOther.maxZoom;
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 8fb876c6..8799faed 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,13 +1,13 @@
name: apple_maps_flutter
description: This plugin uses the Flutter platform view to display an Apple Maps widget.
-version: 1.4.0
+version: 1.5.0
homepage: https://luisthein.de
repository: https://github.com/LuisThein/apple_maps_flutter
issue_tracker: https://github.com/LuisThein/apple_maps_flutter/issues
environment:
- sdk: ">=2.14.0 <3.0.0"
- flutter: ">=1.17.0"
+ sdk: ">=3.0.0 <4.0.0"
+ flutter: ">=3.5.0"
dependencies:
flutter:
diff --git a/test/annotation_updates_test.dart b/test/annotation_updates_test.dart
index fb80e125..5c74092b 100644
--- a/test/annotation_updates_test.dart
+++ b/test/annotation_updates_test.dart
@@ -41,7 +41,7 @@ void main() {
FakePlatformViewsController();
setUpAll(() {
- SystemChannels.platform_views.setMockMethodCallHandler(
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.platform_views,
fakePlatformViewsController.fakePlatformViewsMethodHandler);
});
diff --git a/test/apple_map_test.dart b/test/apple_map_test.dart
index 9e7222ab..5d33c3de 100644
--- a/test/apple_map_test.dart
+++ b/test/apple_map_test.dart
@@ -3,8 +3,7 @@
// found in the LICENSE file.
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
-import 'package:flutter/foundation.dart'
- show debugDefaultTargetPlatformOverride;
+import 'package:flutter/foundation.dart' show debugDefaultTargetPlatformOverride;
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -12,12 +11,10 @@ import 'package:flutter_test/flutter_test.dart';
import 'fake_maps_controllers.dart';
void main() {
- final FakePlatformViewsController fakePlatformViewsController =
- FakePlatformViewsController();
+ final FakePlatformViewsController fakePlatformViewsController = FakePlatformViewsController();
setUpAll(() {
- SystemChannels.platform_views.setMockMethodCallHandler(
- fakePlatformViewsController.fakePlatformViewsMethodHandler);
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.platform_views, fakePlatformViewsController.fakePlatformViewsMethodHandler);
});
setUp(() {
@@ -35,16 +32,13 @@ void main() {
),
);
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
- expect(platformAppleMap.cameraPosition,
- const CameraPosition(target: LatLng(10.0, 15.0)));
+ expect(platformAppleMap.cameraPosition, const CameraPosition(target: LatLng(10.0, 15.0)));
debugDefaultTargetPlatformOverride = null;
});
- testWidgets('Initial camera position change is a no-op',
- (WidgetTester tester) async {
+ testWidgets('Initial camera position change is a no-op', (WidgetTester tester) async {
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
await tester.pumpWidget(
const Directionality(
@@ -64,11 +58,9 @@ void main() {
),
);
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
- expect(platformAppleMap.cameraPosition,
- const CameraPosition(target: LatLng(10.0, 15.0)));
+ expect(platformAppleMap.cameraPosition, const CameraPosition(target: LatLng(10.0, 15.0)));
debugDefaultTargetPlatformOverride = null;
});
@@ -84,8 +76,7 @@ void main() {
),
);
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.compassEnabled, false);
@@ -115,8 +106,7 @@ void main() {
),
);
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.mapType, MapType.hybrid);
@@ -146,11 +136,9 @@ void main() {
),
);
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
- expect(platformAppleMap.minMaxZoomPreference,
- const MinMaxZoomPreference(1.0, 3.0));
+ expect(platformAppleMap.minMaxZoomPreference, const MinMaxZoomPreference(1.0, 3.0));
await tester.pumpWidget(
const Directionality(
@@ -162,8 +150,7 @@ void main() {
),
);
- expect(
- platformAppleMap.minMaxZoomPreference, MinMaxZoomPreference.unbounded);
+ expect(platformAppleMap.minMaxZoomPreference, MinMaxZoomPreference.unbounded);
debugDefaultTargetPlatformOverride = null;
});
@@ -179,8 +166,7 @@ void main() {
),
);
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.rotateGesturesEnabled, false);
@@ -210,8 +196,7 @@ void main() {
),
);
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.scrollGesturesEnabled, false);
@@ -241,8 +226,7 @@ void main() {
),
);
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.pitchGesturesEnabled, false);
@@ -272,8 +256,7 @@ void main() {
),
);
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.zoomGesturesEnabled, false);
@@ -303,8 +286,7 @@ void main() {
),
);
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.myLocationEnabled, false);
@@ -322,8 +304,7 @@ void main() {
debugDefaultTargetPlatformOverride = null;
});
- testWidgets('Can update myLocationButtonEnabled',
- (WidgetTester tester) async {
+ testWidgets('Can update myLocationButtonEnabled', (WidgetTester tester) async {
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
await tester.pumpWidget(
const Directionality(
@@ -335,8 +316,7 @@ void main() {
),
);
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.myLocationButtonEnabled, true);
diff --git a/test/circle_updates_test.dart b/test/circle_updates_test.dart
index a134661c..9c08e7cf 100644
--- a/test/circle_updates_test.dart
+++ b/test/circle_updates_test.dart
@@ -37,12 +37,10 @@ Widget _mapWithCircles(Set? circles) {
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
- final FakePlatformViewsController fakePlatformViewsController =
- FakePlatformViewsController();
+ final FakePlatformViewsController fakePlatformViewsController = FakePlatformViewsController();
setUpAll(() {
- SystemChannels.platform_views.setMockMethodCallHandler(
- fakePlatformViewsController.fakePlatformViewsMethodHandler);
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.platform_views, fakePlatformViewsController.fakePlatformViewsMethodHandler);
});
setUp(() {
@@ -54,8 +52,7 @@ void main() {
final Circle c1 = Circle(circleId: CircleId("circle_1"));
await tester.pumpWidget(_mapWithCircles(_toSet(c1: c1)));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.circlesToAdd!.length, 1);
final Circle initializedCircle = platformAppleMap.circlesToAdd!.first;
@@ -73,8 +70,7 @@ void main() {
await tester.pumpWidget(_mapWithCircles(_toSet(c1: c1)));
await tester.pumpWidget(_mapWithCircles(_toSet(c1: c1, c2: c2)));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.circlesToAdd!.length, 1);
final Circle addedCircle = platformAppleMap.circlesToAdd!.first;
@@ -93,8 +89,7 @@ void main() {
await tester.pumpWidget(_mapWithCircles(_toSet(c1: c1)));
await tester.pumpWidget(_mapWithCircles(null));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.circleIdsToRemove!.length, 1);
expect(platformAppleMap.circleIdsToRemove!.first, equals(c1.circleId));
@@ -111,8 +106,7 @@ void main() {
await tester.pumpWidget(_mapWithCircles(_toSet(c1: c1)));
await tester.pumpWidget(_mapWithCircles(_toSet(c1: c2)));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.circlesToChange!.length, 1);
expect(platformAppleMap.circlesToChange!.first, equals(c2));
@@ -129,8 +123,7 @@ void main() {
await tester.pumpWidget(_mapWithCircles(_toSet(c1: c1)));
await tester.pumpWidget(_mapWithCircles(_toSet(c1: c2)));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.circlesToChange!.length, 1);
final Circle update = platformAppleMap.circlesToChange!.first;
@@ -151,8 +144,7 @@ void main() {
await tester.pumpWidget(_mapWithCircles(prev));
await tester.pumpWidget(_mapWithCircles(cur));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.circlesToChange, cur);
expect(platformAppleMap.circleIdsToRemove!.isEmpty, true);
@@ -174,8 +166,7 @@ void main() {
await tester.pumpWidget(_mapWithCircles(prev));
await tester.pumpWidget(_mapWithCircles(cur));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.circlesToChange!.length, 1);
expect(platformAppleMap.circlesToAdd!.length, 1);
@@ -199,8 +190,7 @@ void main() {
await tester.pumpWidget(_mapWithCircles(prev));
await tester.pumpWidget(_mapWithCircles(cur));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.circlesToChange, _toSet(c3: c3));
expect(platformAppleMap.circleIdsToRemove!.isEmpty, true);
diff --git a/test/fake_maps_controllers.dart b/test/fake_maps_controllers.dart
index fa992ace..f52ef5d7 100644
--- a/test/fake_maps_controllers.dart
+++ b/test/fake_maps_controllers.dart
@@ -11,9 +11,8 @@ import 'package:flutter_test/flutter_test.dart';
class FakePlatformAppleMap {
FakePlatformAppleMap(int id, Map params) {
cameraPosition = CameraPosition.fromMap(params['initialCameraPosition']);
- channel = MethodChannel('apple_maps_plugin.luisthein.de/apple_maps_$id',
- const StandardMethodCodec());
- channel.setMockMethodCallHandler(onMethodCall);
+ channel = MethodChannel('apple_maps_plugin.luisthein.de/apple_maps_$id', const StandardMethodCodec());
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(channel, onMethodCall);
updateOptions(params['options']);
updatePolylines(params);
updateAnnotations(params);
@@ -93,21 +92,16 @@ class FakePlatformAppleMap {
if (annotationUpdates == null) {
return;
}
- annotationsToAdd =
- _deserializeAnnotations(annotationUpdates['annotationsToAdd']);
- annotationIdsToRemove =
- _deserializeAnnotationIds(annotationUpdates['annotationIdsToRemove']);
- annotationsToChange =
- _deserializeAnnotations(annotationUpdates['annotationsToChange']);
+ annotationsToAdd = _deserializeAnnotations(annotationUpdates['annotationsToAdd']);
+ annotationIdsToRemove = _deserializeAnnotationIds(annotationUpdates['annotationIdsToRemove']);
+ annotationsToChange = _deserializeAnnotations(annotationUpdates['annotationsToChange']);
}
Set _deserializeAnnotationIds(List? annotationIds) {
if (annotationIds == null) {
return Set();
}
- return annotationIds
- .map((dynamic annotationId) => AnnotationId(annotationId))
- .toSet();
+ return annotationIds.map((dynamic annotationId) => AnnotationId(annotationId)).toSet();
}
Set _deserializeAnnotations(dynamic annotations) {
@@ -133,12 +127,7 @@ class FakePlatformAppleMap {
}
result.add(
- Annotation(
- annotationId: AnnotationId(annotationId),
- draggable: draggable,
- visible: visible,
- infoWindow: infoWindow,
- alpha: alpha),
+ Annotation(annotationId: AnnotationId(annotationId), draggable: draggable, visible: visible, infoWindow: infoWindow, alpha: alpha),
);
}
@@ -150,19 +139,15 @@ class FakePlatformAppleMap {
return;
}
polylinesToAdd = _deserializePolylines(polylineUpdates['polylinesToAdd']);
- polylineIdsToRemove =
- _deserializePolylineIds(polylineUpdates['polylineIdsToRemove']);
- polylinesToChange =
- _deserializePolylines(polylineUpdates['polylinesToChange']);
+ polylineIdsToRemove = _deserializePolylineIds(polylineUpdates['polylineIdsToRemove']);
+ polylinesToChange = _deserializePolylines(polylineUpdates['polylinesToChange']);
}
Set _deserializePolylineIds(List? polylineIds) {
if (polylineIds == null) {
return Set();
}
- return polylineIds
- .map((dynamic polylineId) => PolylineId(polylineId))
- .toSet();
+ return polylineIds.map((dynamic polylineId) => PolylineId(polylineId)).toSet();
}
Set _deserializePolylines(dynamic polylines) {
@@ -191,8 +176,7 @@ class FakePlatformAppleMap {
return;
}
polygonsToAdd = _deserializePolygons(polygonUpdates['polygonsToAdd']);
- polygonIdsToRemove =
- _deserializePolygonIds(polygonUpdates['polygonIdsToRemove']);
+ polygonIdsToRemove = _deserializePolygonIds(polygonUpdates['polygonIdsToRemove']);
polygonsToChange = _deserializePolygons(polygonUpdates['polygonsToChange']);
}
@@ -239,8 +223,7 @@ class FakePlatformAppleMap {
return;
}
circlesToAdd = _deserializeCircles(circleUpdates['circlesToAdd']);
- circleIdsToRemove =
- _deserializeCircleIds(circleUpdates['circleIdsToRemove']);
+ circleIdsToRemove = _deserializeCircleIds(circleUpdates['circleIdsToRemove']);
circlesToChange = _deserializeCircles(circleUpdates['circlesToChange']);
}
@@ -281,8 +264,7 @@ class FakePlatformAppleMap {
}
if (options.containsKey('minMaxZoomPreference')) {
final List minMaxZoomList = options['minMaxZoomPreference'];
- minMaxZoomPreference =
- MinMaxZoomPreference(minMaxZoomList[0], minMaxZoomList[1]);
+ minMaxZoomPreference = MinMaxZoomPreference(minMaxZoomList[0], minMaxZoomList[1]);
}
if (options.containsKey('rotateGesturesEnabled')) {
rotateGesturesEnabled = options['rotateGesturesEnabled'];
diff --git a/test/polygon_update_test.dart b/test/polygon_update_test.dart
index 221c71d4..d6a8496c 100644
--- a/test/polygon_update_test.dart
+++ b/test/polygon_update_test.dart
@@ -37,12 +37,10 @@ Widget _mapWithPolygons(Set? polygons) {
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
- final FakePlatformViewsController fakePlatformViewsController =
- FakePlatformViewsController();
+ final FakePlatformViewsController fakePlatformViewsController = FakePlatformViewsController();
setUpAll(() {
- SystemChannels.platform_views.setMockMethodCallHandler(
- fakePlatformViewsController.fakePlatformViewsMethodHandler);
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.platform_views, fakePlatformViewsController.fakePlatformViewsMethodHandler);
});
setUp(() {
@@ -54,8 +52,7 @@ void main() {
final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1)));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.polygonsToAdd!.length, 1);
final Polygon initializedPolygon = platformAppleMap.polygonsToAdd!.first;
@@ -73,8 +70,7 @@ void main() {
await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1)));
await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1, p2: p2)));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.polygonsToAdd!.length, 1);
final Polygon addedPolygon = platformAppleMap.polygonsToAdd!.first;
@@ -93,8 +89,7 @@ void main() {
await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1)));
await tester.pumpWidget(_mapWithPolygons(null));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.polygonIdsToRemove!.length, 1);
expect(platformAppleMap.polygonIdsToRemove!.first, equals(p1.polygonId));
@@ -106,14 +101,12 @@ void main() {
testWidgets("Updating a polygon", (WidgetTester tester) async {
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
- final Polygon p2 =
- Polygon(polygonId: PolygonId("polygon_1"), visible: false);
+ final Polygon p2 = Polygon(polygonId: PolygonId("polygon_1"), visible: false);
await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1)));
await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p2)));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.polygonsToChange!.length, 1);
expect(platformAppleMap.polygonsToChange!.first, equals(p2));
@@ -125,14 +118,12 @@ void main() {
testWidgets("Updating a polygon", (WidgetTester tester) async {
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
final Polygon p1 = Polygon(polygonId: PolygonId("polygon_1"));
- final Polygon p2 =
- Polygon(polygonId: PolygonId("polygon_1"), visible: false);
+ final Polygon p2 = Polygon(polygonId: PolygonId("polygon_1"), visible: false);
await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1)));
await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p2)));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.polygonsToChange!.length, 1);
final Polygon update = platformAppleMap.polygonsToChange!.first;
@@ -152,8 +143,7 @@ void main() {
p1.points.add(const LatLng(1.0, 1.0));
await tester.pumpWidget(_mapWithPolygons(_toSet(p1: p1)));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.polygonsToChange!.length, 1);
expect(platformAppleMap.polygonsToChange!.first, equals(p1));
@@ -174,8 +164,7 @@ void main() {
await tester.pumpWidget(_mapWithPolygons(prev));
await tester.pumpWidget(_mapWithPolygons(cur));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.polygonsToChange, cur);
expect(platformAppleMap.polygonIdsToRemove!.isEmpty, true);
@@ -197,8 +186,7 @@ void main() {
await tester.pumpWidget(_mapWithPolygons(prev));
await tester.pumpWidget(_mapWithPolygons(cur));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.polygonsToChange!.length, 1);
expect(platformAppleMap.polygonsToAdd!.length, 1);
@@ -222,8 +210,7 @@ void main() {
await tester.pumpWidget(_mapWithPolygons(prev));
await tester.pumpWidget(_mapWithPolygons(cur));
- final FakePlatformAppleMap platformAppleMap =
- fakePlatformViewsController.lastCreatedView!;
+ final FakePlatformAppleMap platformAppleMap = fakePlatformViewsController.lastCreatedView!;
expect(platformAppleMap.polygonsToChange, _toSet(p3: p3));
expect(platformAppleMap.polygonIdsToRemove!.isEmpty, true);
diff --git a/test/polyline_updates_test.dart b/test/polyline_updates_test.dart
index 1532e858..02a820fb 100644
--- a/test/polyline_updates_test.dart
+++ b/test/polyline_updates_test.dart
@@ -40,7 +40,7 @@ void main() {
FakePlatformViewsController();
setUpAll(() {
- SystemChannels.platform_views.setMockMethodCallHandler(
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.platform_views,
fakePlatformViewsController.fakePlatformViewsMethodHandler);
});