a14n / dart-google-maps

A library to use Google Maps JavaScript API v3 from Dart scripts.
Apache License 2.0
130 stars 66 forks source link

Allow package `web: ^1.0.0` #135

Closed ditman closed 4 months ago

ditman commented 4 months ago

Hey @a14n!

I'm looking at updating flutter/packages to the latest major version of package:web, and I think I need a small change in google_maps: allowing web 1.0.0.

It seems the only other changes needed are to the examples, where the use of innerHTML has gone from String to JSAny (so Trusted Types are supported), but it seems the rest is all right.

I re-ran the build script(s) but nothing else seems to have changed:

dit@dit:/work/a14n/google_maps$ dart --no-sound-null-safety tool/generate_lib.dart 
Setting VM flags failed: Unrecognized flags: sound_null_safety
dit@dit:/work/a14n/google_maps$ dart tool/generate_lib.dart 
dit@dit:/work/a14n/google_maps$ dart run build_runner build --delete-conflicting-outputs -v lib
Building package executable... (6.7s)
Built build_runner:build_runner.
[INFO] Entrypoint:Generating build script...
[INFO] Entrypoint:Generating build script completed, took 465ms

[INFO] Bootstrap:Precompiling build script......
[INFO] Bootstrap:Precompiling build script... completed, took 6.4s

[FINE] Bootstrap:Core package locations file does not exist
[INFO] BuildDefinition:Initializing inputs
[INFO] BuildDefinition:Building new asset graph...
[INFO] BuildDefinition:Building new asset graph completed, took 2.0s

[INFO] BuildDefinition:Checking for unexpected pre-existing outputs....
[INFO] BuildDefinition:Checking for unexpected pre-existing outputs. completed, took 0ms

[INFO] Build:Running build...
[INFO] Build:Running build completed, took 391ms

[INFO] Build:Caching finalized dependency graph...
[INFO] Build:Caching finalized dependency graph completed, took 304ms

[INFO] Build:Succeeded after 705ms with 0 outputs (2522 actions)

I've also updated the README-dev so it doesn't fail with the VM flags error, but that may be because I'm in a Dart SDK from the future (whatever is bundled with flutter master).

(As usual, thanks for the package!!)

ditman commented 4 months ago

More info:

ditman commented 4 months ago

Also a small question: why are there isFooDefined() methods, instead of making .foo nullable? (For example: "isTiltDefined()" in the map object?)

Is there a difference between undefined and null in the JS SDK?

a14n commented 4 months ago

Thanks!

Also a small question: why are there isFooDefined() methods, instead of making .foo nullable? (For example: "isTiltDefined()" in the map object?)

Usually those properties have always values once the map is initialized (with a center and zoom level) so 99% of the time it is non-null. Having isFooDefined() allows checking nullity in the rare cases where you access the property before the map is initialized. Once initialized you now avoid a lot of null checks. For instance, in examples, those isXxxDefined() are almost never used.

a14n commented 4 months ago

8.0.0-dev.3 published

ditman commented 4 months ago

Having isFooDefined() allows checking nullity in the rare cases where you access the property before the map is initialized.

This sounds good to me, my only concern is that these methods seem a little bit hard to find in the API. In the flutter plugin most of the usages are in tests, or on my wacky "convert.dart" file.