Skip to content

Commit e6eddbe

Browse files
committed
Upgrade dart and flutter versions
1 parent 236e511 commit e6eddbe

File tree

22 files changed

+142
-133
lines changed

22 files changed

+142
-133
lines changed

arcgis_map_sdk/lib/arcgis_map_sdk.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// ignore: unnecessary_library_directive
2-
library arcgis_map;
3-
41
export 'package:arcgis_map_sdk/src/arcgis_location_display.dart';
52
export 'package:arcgis_map_sdk/src/arcgis_map_controller.dart';
63
export 'package:arcgis_map_sdk/src/arcgis_map_sdk.dart';

arcgis_map_sdk/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ maintainer: Matthaios Saitakis (@MatthaiosSait), Stefan Schaller (@stefanschalle
66
Pascal Welsch (@passsy), Max Peters (@maxpeters)
77

88
environment:
9-
sdk: ">=3.0.0 <4.0.0"
10-
flutter: ">=3.10.0"
9+
sdk: ">=3.2.0 <4.0.0"
10+
flutter: ">=3.16.0"
1111

1212
dependencies:
1313
arcgis_map_sdk_android: ^0.8.0

arcgis_map_sdk_android/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ repository: https://github.com/fluttercommunity/arcgis_map_sdk
55
maintainer: Stefan Schaller (@stefanschaller), Julian Bissekkou (@JulianBissekkou)
66

77
environment:
8-
sdk: ">=3.0.0 <4.0.0"
9-
flutter: ">=3.10.0"
8+
sdk: ">=3.2.0 <4.0.0"
9+
flutter: ">=3.16.0"
1010

1111
dependencies:
1212
arcgis_map_sdk_method_channel: ^0.8.0

arcgis_map_sdk_ios/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ repository: https://github.com/fluttercommunity/arcgis_map_sdk
55
maintainer: Stefan Schaller (@stefanschaller), Julian Bissekkou (@JulianBissekkou)
66

77
environment:
8-
sdk: ">=3.0.0 <4.0.0"
9-
flutter: ">=3.10.0"
8+
sdk: ">=3.2.0 <4.0.0"
9+
flutter: ">=3.16.0"
1010

1111
dependencies:
1212
arcgis_map_sdk_method_channel: ^0.8.0

arcgis_map_sdk_method_channel/lib/src/method_channel_arcgis_map_plugin.dart

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class MethodChannelArcgisMapPlugin extends ArcgisMapPlatform {
2525
int mapId,
2626
void Function(double)? getZoom,
2727
String layerId,
28-
) async {
28+
) {
2929
throw UnimplementedError('addFeatureLayer() has not been implemented.');
3030
}
3131

@@ -43,7 +43,8 @@ class MethodChannelArcgisMapPlugin extends ArcgisMapPlatform {
4343

4444
@override
4545
Future<void> setAutoPanMode(String autoPanMode, int mapId) {
46-
return _methodChannelBuilder(mapId).invokeMethod("set_auto_pan_mode", autoPanMode);
46+
return _methodChannelBuilder(mapId)
47+
.invokeMethod("set_auto_pan_mode", autoPanMode);
4748
}
4849

4950
@override
@@ -121,7 +122,7 @@ class MethodChannelArcgisMapPlugin extends ArcgisMapPlatform {
121122
required int mapId,
122123
required String featureLayerId,
123124
required List<Graphic> data,
124-
}) async {
125+
}) {
125126
throw UnimplementedError('addFeatureLayer() has not been implemented.');
126127
}
127128

@@ -165,7 +166,7 @@ class MethodChannelArcgisMapPlugin extends ArcgisMapPlatform {
165166
AnimationOptions? animationOptions,
166167
int? threeDHeading,
167168
int? threeDTilt,
168-
}) async {
169+
}) {
169170
return _methodChannelBuilder(mapId).invokeMethod<bool>(
170171
"move_camera",
171172
{
@@ -196,7 +197,7 @@ class MethodChannelArcgisMapPlugin extends ArcgisMapPlatform {
196197
required int lodFactor,
197198
required int mapId,
198199
AnimationOptions? animationOptions,
199-
}) async {
200+
}) {
200201
return _methodChannelBuilder(mapId).invokeMethod<bool>(
201202
"zoom_in",
202203
{"lodFactor": lodFactor},
@@ -208,15 +209,15 @@ class MethodChannelArcgisMapPlugin extends ArcgisMapPlatform {
208209
required int lodFactor,
209210
required int mapId,
210211
AnimationOptions? animationOptions,
211-
}) async {
212+
}) {
212213
return _methodChannelBuilder(mapId).invokeMethod<bool>(
213214
"zoom_out",
214215
{"lodFactor": lodFactor},
215216
).then((value) => value!);
216217
}
217218

218219
@override
219-
Future<void> retryLoad(int mapId) async {
220+
Future<void> retryLoad(int mapId) {
220221
return _methodChannelBuilder(mapId).invokeMethod("retryLoad");
221222
}
222223

arcgis_map_sdk_method_channel/lib/src/model_extension.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ extension on MeshSymbol3D {
110110
{
111111
'type': 'fill',
112112
'material': {
113-
'color': [color.red, color.green, color.blue, colorOpacity],
113+
'color': [color.r, color.g, color.b, colorOpacity],
114114
},
115115
},
116116
],
@@ -174,10 +174,10 @@ Map<String, Object?>? _colorToJson(Color? color) {
174174
if (color == null) return null;
175175

176176
return {
177-
'red': color.red,
178-
'green': color.green,
179-
'blue': color.blue,
180-
'opacity': color.opacity,
177+
'red': color.r,
178+
'green': color.g,
179+
'blue': color.b,
180+
'opacity': color.a / 255,
181181
};
182182
}
183183

arcgis_map_sdk_method_channel/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ repository: https://github.com/fluttercommunity/arcgis_map_sdk
55
maintainer: Stefan Schaller (@stefanschaller), Julian Bissekkou (@JulianBissekkou)
66

77
environment:
8-
sdk: ">=3.0.0 <4.0.0"
9-
flutter: ">=3.10.0"
8+
sdk: ">=3.2.0 <4.0.0"
9+
flutter: ">=3.16.0"
1010

1111
dependencies:
1212
arcgis_map_sdk_platform_interface: ^1.0.1

arcgis_map_sdk_platform_interface/lib/arcgis_map_sdk_platform_interface.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// ignore: unnecessary_library_directive
2-
library arcgis_map_sdk_platform_interface;
3-
41
export 'package:arcgis_map_sdk_platform_interface/src/arcgis_map_sdk_platform_interface.dart';
52
export 'package:arcgis_map_sdk_platform_interface/src/events/map_event.dart';
63
export 'package:arcgis_map_sdk_platform_interface/src/models/animation_options.dart';

arcgis_map_sdk_platform_interface/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ maintainer: Matthaios Saitakis (@MatthaiosSait), Stefan Schaller (@stefanschalle
66
Pascal Welsch (@passsy), Max Peters (@maxpeters)
77

88
environment:
9-
sdk: ">=3.0.0 <4.0.0"
10-
flutter: ">=3.10.0"
9+
sdk: ">=3.2.0 <4.0.0"
10+
flutter: ">=3.16.0"
1111

1212
dependencies:
1313
flutter:

arcgis_map_sdk_web/lib/arcgis_map_web_js.dart

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
@JS()
2-
library arcgis_map_sdk_web;
3-
42
import 'dart:async';
5-
import 'dart:js_util';
6-
73
import 'package:js/js.dart';
4+
import 'package:js/js_util.dart';
5+
import 'package:web/web.dart';
86

97
export 'package:arcgis_map_sdk_web/src/arcgis_map_sdk_web.dart';
108

@@ -420,12 +418,8 @@ class JsHandle {
420418
@JS()
421419
class Popup {}
422420

423-
@JS()
424-
@staticInterop
425-
class WebGLRenderingContext {}
426-
427421
extension WebGLRenderingContextExtension on WebGLRenderingContext {
428-
external WebglLoseContext? getExtension(String something);
422+
external WebglLoseContext? getCustomExtension(String something);
429423
}
430424

431425
@JS()

arcgis_map_sdk_web/lib/src/arcgis_map_sdk_web.dart

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import 'dart:async';
2-
import 'dart:html';
3-
import 'dart:js';
42

53
import 'package:arcgis_map_sdk_platform_interface/arcgis_map_sdk_platform_interface.dart';
64
import 'package:arcgis_map_sdk_web/src/arcgis_map_web_controller.dart';
75
import 'package:flutter/material.dart';
86
import 'package:flutter/services.dart';
97
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
8+
import 'package:js/js_util.dart';
9+
import 'package:web/web.dart';
1010

1111
class ArcgisMapWeb extends ArcgisMapPlatform {
1212
static final _hasScriptLoaded = Completer();
@@ -15,15 +15,14 @@ class ArcgisMapWeb extends ArcgisMapPlatform {
1515
ArcgisMapPlatform.instance = ArcgisMapWeb();
1616

1717
//load webpack custom build of the ArcGIS JS API
18-
final script = ScriptElement()
19-
..addEventListener("load", (event) => _hasScriptLoaded.complete())
20-
// ignore: unsafe_html
18+
final script = HTMLScriptElement()
2119
..src =
2220
"assets/packages/arcgis_map_sdk_web/assets/arcgis_js_api_custom_build/main.js";
2321

22+
script.onLoad.listen((event) => _hasScriptLoaded.complete());
2423
document.head!.append(script);
2524

26-
final link = LinkElement()
25+
final link = HTMLLinkElement()
2726
..type = "text/css"
2827
..href =
2928
"assets/packages/arcgis_map_sdk_web/assets/css_overrides/override_outline.css"
@@ -120,7 +119,7 @@ class ArcgisMapWeb extends ArcgisMapPlatform {
120119
}
121120

122121
@override
123-
Future<void> toggleBaseMap(int mapId, BaseMap baseMap) async {
122+
Future<void> toggleBaseMap(int mapId, BaseMap baseMap) {
124123
return _map(mapId).toggleBaseMap(baseMap: baseMap);
125124
}
126125

@@ -140,7 +139,7 @@ class ArcgisMapWeb extends ArcgisMapPlatform {
140139
int mapId,
141140
void Function(double)? getZoom,
142141
String layerId,
143-
) async {
142+
) {
144143
return _map(mapId)
145144
.addFeatureLayer(options, data, onPressed, url, getZoom, layerId);
146145
}
@@ -151,7 +150,7 @@ class ArcgisMapWeb extends ArcgisMapPlatform {
151150
int mapId,
152151
String layerId,
153152
void Function(dynamic)? onPressed,
154-
) async {
153+
) {
155154
return _map(mapId).addGraphicsLayer(
156155
options,
157156
layerId,
@@ -165,7 +164,7 @@ class ArcgisMapWeb extends ArcgisMapPlatform {
165164
required String layerId,
166165
required String url,
167166
required int mapId,
168-
}) async {
167+
}) {
169168
return _map(mapId).addSceneLayer(
170169
options: options,
171170
layerId: layerId,
@@ -283,8 +282,14 @@ class ArcgisMapWeb extends ArcgisMapPlatform {
283282
///
284283
/// https://developers.arcgis.com/javascript/latest/es-modules/#managing-assets-locally
285284
// ignore: avoid_dynamic_calls
286-
context["esri"]["core"]["config"]["assetsPath"] =
287-
"/assets/packages/arcgis_map_sdk_web/assets/arcgis_js_api_custom_build/assets";
285+
final esri = getProperty<Object>(globalThis, 'esri');
286+
final core = getProperty<Object>(esri, 'core');
287+
final config = getProperty<Object>(core, 'config');
288+
setProperty(
289+
config,
290+
'assetsPath',
291+
"/assets/packages/arcgis_map_sdk_web/assets/arcgis_js_api_custom_build/assets",
292+
);
288293
});
289294

290295
final mapController = ArcgisMapWebController(

arcgis_map_sdk_web/lib/src/arcgis_map_web_controller.dart

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import 'dart:async';
2-
import 'dart:html';
3-
import 'dart:js';
4-
import 'dart:js_util';
2+
import 'dart:js_interop';
53
import 'dart:ui' as ui;
64

75
import 'package:arcgis_map_sdk_platform_interface/arcgis_map_sdk_platform_interface.dart';
@@ -15,6 +13,8 @@ import 'package:async/async.dart';
1513
import 'package:flutter/material.dart';
1614
import 'package:flutter/services.dart';
1715
import 'package:flutter/widgets.dart';
16+
import 'package:js/js_util.dart';
17+
import 'package:web/web.dart';
1818

1919
class ArcgisMapWebController {
2020
final int _mapId;
@@ -35,7 +35,7 @@ class ArcgisMapWebController {
3535
maxZoom: _mapOptions.maxZoom,
3636
);
3737

38-
late final _div = DivElement()
38+
late final _div = HTMLDivElement()
3939
..id = _getViewType(_mapId)
4040
..style.width = '100%'
4141
..style.height = '100%';
@@ -90,8 +90,10 @@ class ArcgisMapWebController {
9090
}
9191

9292
Future<void> _createMap() async {
93-
// ignore: avoid_dynamic_calls
94-
context["esri"]["core"]["config"]["apiKey"] = _mapOptions.apiKey;
93+
final esri = getProperty<Object>(globalThis, 'esri');
94+
final core = getProperty<Object>(esri, 'core');
95+
final config = getProperty<Object>(core, 'config');
96+
setProperty(config, 'apiKey', _mapOptions.apiKey);
9597

9698
if (_mapOptions.mapStyle == MapStyle.threeD) {
9799
_sceneView = _createJsSceneView();
@@ -171,7 +173,7 @@ class ArcgisMapWebController {
171173
void Function(double)? getZoom,
172174
String layerId,
173175
) async {
174-
if (context["FeatureLayer"] == null) {
176+
if (getProperty(globalThis, "FeatureLayer") == null) {
175177
await promiseToFuture(loadFeatureLayer());
176178
}
177179
return _layerController!.createFeatureLayer(
@@ -189,7 +191,7 @@ class ArcgisMapWebController {
189191
required SceneLayerOptions options,
190192
required String layerId,
191193
required String url,
192-
}) async {
194+
}) {
193195
final scene = _layerController!.createSceneLayer(
194196
options: options,
195197
layerId: layerId,
@@ -209,7 +211,7 @@ class ArcgisMapWebController {
209211
GraphicsLayerOptions options,
210212
String layerId,
211213
void Function(dynamic)? onPressed,
212-
) async {
214+
) {
213215
return _layerController!.createGraphicsLayer(
214216
options,
215217
layerId,
@@ -254,23 +256,23 @@ class ArcgisMapWebController {
254256
);
255257
// "webgl" (or "experimental-webgl") which will create a WebGLRenderingContext object representing a
256258
// three-dimensional rendering context. This context is only available on browsers that implement WebGL version 1 (OpenGL ES 2.0).
257-
final webgl = (canvasElement as CanvasElement?)?.getContext('webgl');
259+
final webgl = (canvasElement as HTMLCanvasElement?)?.getContext('webgl');
258260
// "webgl2" which will create a WebGL2RenderingContext object representing a three-dimensional rendering context.
259261
// This context is only available on browsers that implement WebGL version 2 (OpenGL ES 3.0)
260262
final webgl2 = canvasElement?.getContext('webgl2');
261263

262264
if (webgl != null) {
263265
(webgl as WebGLRenderingContext)
264-
.getExtension('WEBGL_lose_context')
266+
.getCustomExtension('WEBGL_lose_context')
265267
?.loseContext();
266-
webgl.getExtension('WEBGL_lose_context')?.restoreContext();
268+
webgl.getCustomExtension('WEBGL_lose_context')?.restoreContext();
267269
}
268270

269271
if (webgl2 != null) {
270272
(webgl2 as WebGLRenderingContext)
271-
.getExtension('WEBGL_lose_context')
273+
.getCustomExtension('WEBGL_lose_context')
272274
?.loseContext();
273-
webgl2.getExtension('WEBGL_lose_context')?.restoreContext();
275+
webgl2.getCustomExtension('WEBGL_lose_context')?.restoreContext();
274276
}
275277
}
276278

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import "dart:js_util" as js_util;
2-
31
import 'package:arcgis_map_sdk_web/arcgis_map_web_js.dart';
2+
import 'package:js/js_util.dart';
43

54
/// The attribution attached to the map view
65
class Attribution {
76
JsAttribution init({dynamic view}) => JsAttribution(
8-
js_util.jsify({"view": view}),
7+
jsify({"view": view}),
98
);
109
}

0 commit comments

Comments
 (0)