diff --git a/.github/workflows/flutter_ci.yml b/.github/workflows/flutter_ci.yml
index 24f40a2e..d1462d85 100644
--- a/.github/workflows/flutter_ci.yml
+++ b/.github/workflows/flutter_ci.yml
@@ -4,7 +4,7 @@ on: [push, pull_request, workflow_dispatch]
env:
FLUTTER_CHANNEL: 'stable'
- FLUTTER_VERSION: '2.5.3'
+ FLUTTER_VERSION: '2.10.5'
jobs:
format:
diff --git a/android/build.gradle b/android/build.gradle
index 2584c716..eb98adf9 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -4,7 +4,7 @@ version '1.0-SNAPSHOT'
buildscript {
repositories {
google()
- jcenter()
+ mavenCentral()
}
dependencies {
@@ -15,7 +15,6 @@ buildscript {
rootProject.allprojects {
repositories {
google()
- jcenter()
mavenCentral()
}
}
@@ -23,7 +22,9 @@ rootProject.allprojects {
apply plugin: 'com.android.library'
android {
- compileSdkVersion 29
+
+ compileSdkVersion 31
+ ndkVersion "20.1.5948944"
defaultConfig {
minSdkVersion 20
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
index 6d6819d3..2c6f16a9 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -25,7 +25,8 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 29
+ compileSdkVersion 31
+ ndkVersion "20.1.5948944"
lintOptions {
disable 'InvalidPackage'
@@ -35,7 +36,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.mapbox.mapboxglexample"
minSdkVersion 20
- targetSdkVersion 28
+ targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml
index 32dd1347..a8a23b43 100644
--- a/example/android/app/src/main/AndroidManifest.xml
+++ b/example/android/app/src/main/AndroidManifest.xml
@@ -5,12 +5,13 @@
initPlatform(int id) async {
- await MapLibreGlPlatform.getInstance(id).initPlatform(id);
- }
-
final OnStyleLoadedCallback? onStyleLoadedCallback;
final OnMapClickCallback? onMapClick;
@@ -241,14 +207,14 @@ class MaplibreMapController extends ChangeNotifier {
CameraPosition? get cameraPosition => _cameraPosition;
CameraPosition? _cameraPosition;
- final int _id; //ignore: unused_field
+ final MapLibreGlPlatform _mapboxGlPlatform; //ignore: unused_field
Widget buildView(
Map creationParams,
OnPlatformViewCreatedCallback onPlatformViewCreated,
Set> gestureRecognizers) {
- return MapLibreGlPlatform.getInstance(_id)
- .buildView(creationParams, onPlatformViewCreated, gestureRecognizers);
+ return _mapboxGlPlatform.buildView(
+ creationParams, onPlatformViewCreated, gestureRecognizers);
}
/// Updates configuration options of the map user interface.
@@ -258,8 +224,7 @@ class MaplibreMapController extends ChangeNotifier {
///
/// The returned [Future] completes after listeners have been notified.
Future _updateMapOptions(Map optionsUpdate) async {
- _cameraPosition = await MapLibreGlPlatform.getInstance(_id)
- .updateMapOptions(optionsUpdate);
+ _cameraPosition = await _mapboxGlPlatform.updateMapOptions(optionsUpdate);
notifyListeners();
}
@@ -270,7 +235,7 @@ class MaplibreMapController extends ChangeNotifier {
/// It returns true if the camera was successfully moved and false if the movement was canceled.
/// Note: this currently always returns immediately with a value of null on iOS
Future animateCamera(CameraUpdate cameraUpdate) async {
- return MapLibreGlPlatform.getInstance(_id).animateCamera(cameraUpdate);
+ return _mapboxGlPlatform.animateCamera(cameraUpdate);
}
/// Instantaneously re-position the camera.
@@ -281,7 +246,7 @@ class MaplibreMapController extends ChangeNotifier {
/// It returns true if the camera was successfully moved and false if the movement was canceled.
/// Note: this currently always returns immediately with a value of null on iOS
Future moveCamera(CameraUpdate cameraUpdate) async {
- return MapLibreGlPlatform.getInstance(_id).moveCamera(cameraUpdate);
+ return _mapboxGlPlatform.moveCamera(cameraUpdate);
}
/// Updates user location tracking mode.
@@ -290,7 +255,7 @@ class MaplibreMapController extends ChangeNotifier {
/// platform side.
Future updateMyLocationTrackingMode(
MyLocationTrackingMode myLocationTrackingMode) async {
- return MapLibreGlPlatform.getInstance(_id)
+ return _mapboxGlPlatform
.updateMyLocationTrackingMode(myLocationTrackingMode);
}
@@ -299,8 +264,7 @@ class MaplibreMapController extends ChangeNotifier {
/// The returned [Future] completes after the change has been made on the
/// platform side.
Future matchMapLanguageWithDeviceDefault() async {
- return MapLibreGlPlatform.getInstance(_id)
- .matchMapLanguageWithDeviceDefault();
+ return _mapboxGlPlatform.matchMapLanguageWithDeviceDefault();
}
/// Updates the distance from the edges of the map view’s frame to the edges
@@ -316,8 +280,7 @@ class MaplibreMapController extends ChangeNotifier {
/// platform side.
Future updateContentInsets(EdgeInsets insets,
[bool animated = false]) async {
- return MapLibreGlPlatform.getInstance(_id)
- .updateContentInsets(insets, animated);
+ return _mapboxGlPlatform.updateContentInsets(insets, animated);
}
/// Updates the language of the map labels to match the specified language.
@@ -327,7 +290,7 @@ class MaplibreMapController extends ChangeNotifier {
/// The returned [Future] completes after the change has been made on the
/// platform side.
Future setMapLanguage(String language) async {
- return MapLibreGlPlatform.getInstance(_id).setMapLanguage(language);
+ return _mapboxGlPlatform.setMapLanguage(language);
}
/// Enables or disables the collection of anonymized telemetry data.
@@ -335,7 +298,7 @@ class MaplibreMapController extends ChangeNotifier {
/// The returned [Future] completes after the change has been made on the
/// platform side.
Future setTelemetryEnabled(bool enabled) async {
- return MapLibreGlPlatform.getInstance(_id).setTelemetryEnabled(enabled);
+ return _mapboxGlPlatform.setTelemetryEnabled(enabled);
}
/// Retrieves whether collection of anonymized telemetry data is enabled.
@@ -343,7 +306,7 @@ class MaplibreMapController extends ChangeNotifier {
/// The returned [Future] completes after the query has been made on the
/// platform side.
Future getTelemetryEnabled() async {
- return MapLibreGlPlatform.getInstance(_id).getTelemetryEnabled();
+ return _mapboxGlPlatform.getTelemetryEnabled();
}
/// Adds a symbol to the map, configured using the specified custom [options].
@@ -373,8 +336,7 @@ class MaplibreMapController extends ChangeNotifier {
final List effectiveOptions =
options.map((o) => SymbolOptions.defaultOptions.copyWith(o)).toList();
- final symbols = await MapLibreGlPlatform.getInstance(_id)
- .addSymbols(effectiveOptions, data);
+ final symbols = await _mapboxGlPlatform.addSymbols(effectiveOptions, data);
symbols.forEach((s) => _symbols[s.id] = s);
notifyListeners();
return symbols;
@@ -389,7 +351,8 @@ class MaplibreMapController extends ChangeNotifier {
/// The returned [Future] completes once listeners have been notified.
Future updateSymbol(Symbol symbol, SymbolOptions changes) async {
assert(_symbols[symbol.id] == symbol);
- await MapLibreGlPlatform.getInstance(_id).updateSymbol(symbol, changes);
+
+ await _mapboxGlPlatform.updateSymbol(symbol, changes);
symbol.options = symbol.options.copyWith(changes);
notifyListeners();
}
@@ -399,8 +362,7 @@ class MaplibreMapController extends ChangeNotifier {
/// In that case this method provides the symbol's actual position, and `symbol.options.geometry` the last programmatically set position.
Future getSymbolLatLng(Symbol symbol) async {
assert(_symbols[symbol.id] == symbol);
- final symbolLatLng =
- await MapLibreGlPlatform.getInstance(_id).getSymbolLatLng(symbol);
+ final symbolLatLng = await _mapboxGlPlatform.getSymbolLatLng(symbol);
notifyListeners();
return symbolLatLng;
}
@@ -440,7 +402,7 @@ class MaplibreMapController extends ChangeNotifier {
///
/// The returned [Future] completes once listeners have been notified.
Future clearSymbols() async {
- await MapLibreGlPlatform.getInstance(_id).removeSymbols(_symbols.keys);
+ await _mapboxGlPlatform.removeSymbols(_symbols.keys);
_symbols.clear();
notifyListeners();
}
@@ -451,7 +413,7 @@ class MaplibreMapController extends ChangeNotifier {
/// The returned [Future] completes once the symbol has been removed from
/// [_symbols].
Future _removeSymbols(Iterable ids) async {
- await MapLibreGlPlatform.getInstance(_id).removeSymbols(ids);
+ await _mapboxGlPlatform.removeSymbols(ids);
_symbols.removeWhere((k, s) => ids.contains(k));
}
@@ -465,8 +427,7 @@ class MaplibreMapController extends ChangeNotifier {
Future addLine(LineOptions options, [Map? data]) async {
final LineOptions effectiveOptions =
LineOptions.defaultOptions.copyWith(options);
- final line = await MapLibreGlPlatform.getInstance(_id)
- .addLine(effectiveOptions, data);
+ final line = await _mapboxGlPlatform.addLine(effectiveOptions, data);
_lines[line.id] = line;
notifyListeners();
return line;
@@ -481,8 +442,7 @@ class MaplibreMapController extends ChangeNotifier {
/// been notified.
Future> addLines(List options,
[List