-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[google_maps_flutter_web] Migrate to package:web #5254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
8800cc7
0c9fc45
8960e3d
b420f32
a0637f1
636e71f
639fe97
c22678e
147e570
5ff2982
c4581dd
0fb3d67
9898737
18564d2
aa9533a
1667de9
c43f31e
a14981c
32d66fa
788d35a
1040103
edc00a8
cd2b0e8
861f294
bb8810f
e578d86
638a466
75db30d
2c086d2
fb7f53a
aee9770
9f2716e
cb9c665
aa46171
0523daa
e2df4b1
e358399
736aec1
8b4d7bb
d8adca1
52baeca
1951a6a
6583739
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,9 +6,54 @@ import 'dart:js_interop'; | |
|
|
||
| import 'package:web/web.dart'; | ||
|
|
||
| /// This extension exists to handle unsupported features by certain browsers. | ||
| extension DomWindowExtension on Window { | ||
| /// This extension type exists to handle unsupported features by certain browsers. | ||
| @JS() | ||
| extension type WindowWithTrustedTypes(Window _) implements JSObject { | ||
| /// Get the `trustedTypes` object from the window, if it is supported. | ||
| @JS('trustedTypes') | ||
| external TrustedTypePolicyFactory? get trustedTypesNullable; | ||
| } | ||
|
|
||
| // TODO(ditman): remove this extension type when we depend on package:web 0.5.1 | ||
| /// This extension exists as a stop gap until `package:web 0.5.1` is released. | ||
| /// That version provides the `TrustedTypes` API. | ||
| @JS() | ||
| extension type TrustedTypePolicyFactory._(JSObject _) implements JSObject { | ||
|
||
| /// Create a new `TrustedTypePolicy` instance | ||
| /// with the given [policyName] and [policyOptions]. | ||
| external TrustedTypePolicy createPolicy( | ||
| String policyName, [ | ||
| TrustedTypePolicyOptions policyOptions, | ||
| ]); | ||
| } | ||
|
|
||
| // TODO(ditman): remove this extension type when we depend on package:web 0.5.1 | ||
| /// This extension exists as a stop gap until `package:web 0.5.1` is released. | ||
| /// That version provides the `TrustedTypes` API. | ||
| extension type TrustedTypePolicy._(JSObject _) implements JSObject { | ||
| /// Create a new `TrustedHTML` instance with the given [input] and [arguments]. | ||
| external TrustedHTML createHTML( | ||
| String input, | ||
| JSAny? arguments, | ||
| ); | ||
| } | ||
|
|
||
| // TODO(ditman): remove this extension type when we depend on package:web 0.5.1 | ||
| /// This extension exists as a stop gap until `package:web 0.5.1` is released. | ||
| /// That version provides the `TrustedTypes` API. | ||
| @JS() | ||
| extension type TrustedTypePolicyOptions._(JSObject _) implements JSObject { | ||
| /// Create a new `TrustedTypePolicyOptions` instance. | ||
| external factory TrustedTypePolicyOptions({ | ||
| JSFunction createHTML, | ||
| }); | ||
| } | ||
|
|
||
| // TODO(ditman): remove this extension type when we depend on package:web 0.5.1 | ||
| /// This extension exists as a stop gap until `package:web 0.5.1` is released. | ||
| /// That version provides the `TrustedTypes` API. | ||
| @JS() | ||
| extension type TrustedHTML._(JSObject _) implements JSObject { | ||
| // This type inherits `toString()` from `Object`. | ||
| // See also: https://developer.mozilla.org/en-US/docs/Web/API/TrustedHTML/toString | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not blocking for this review, but when I tried to do a Wasm build of the google maps' example app for web, I still get some errors coming from the google_maps package:
Error: Dart library 'dart:web_gl' is not available on this platform.
library 'package:js/js.dart' can't be imported when compiling to Wasm.
library 'package:js/js_util.dart' can't be imported when compiling to Wasm.
'package:js/js.dart' can't be imported when compiling to Wasm.
'package:js/js_util.dart' can't be imported when compiling to Wasm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we file a tracking issue for google_maps WASM support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should, compiling to
--wasmis the main goal of this migration.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/FYI @kevmoo!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah 💩 . Ugh...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a14n/dart-google-maps#125