From cd576dbb6b2897dd89fddb515e3743c28326db16 Mon Sep 17 00:00:00 2001 From: David Iglesias Date: Wed, 24 Jul 2024 00:28:14 -0700 Subject: [PATCH] Allow package `web: ^1.0.0` (#135) * Allow web: 0.X and 1.X * Update examples to latest web changes. * Update CHANGELOG to reflect the package:web bracket. * Tighten lower web version to 0.5.1 --- CHANGELOG.md | 4 ++++ README-dev.md | 2 +- example/directions-complex/page.dart | 2 +- example/directions-waypoints/page.dart | 2 +- example/distance-matrix/page.dart | 2 +- example/places-autocomplete-hotelsearch/page.dart | 6 +++--- example/places-queryprediction/page.dart | 2 +- example/streetview-event/page.dart | 8 ++++---- pubspec.yaml | 8 ++++---- 9 files changed, 20 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7507668..f680281c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 8.0.0-dev.3 + +- allow package:web ^1.0.0 + # 8.0.0-dev.2 - some minor changes diff --git a/README-dev.md b/README-dev.md index dbc14588..48e46153 100644 --- a/README-dev.md +++ b/README-dev.md @@ -10,6 +10,6 @@ There are 2 steps: 2. Generate real code with [js_wrapping_generator](https://pub.dev/packages/js_wrapping_generator) ``` -dart --no-sound-null-safety tool/generate_lib.dart +dart tool/generate_lib.dart dart run build_runner build --delete-conflicting-outputs -v lib ``` \ No newline at end of file diff --git a/example/directions-complex/page.dart b/example/directions-complex/page.dart index 96928ce8..b433e3f2 100644 --- a/example/directions-complex/page.dart +++ b/example/directions-complex/page.dart @@ -53,7 +53,7 @@ void calcRoute() async { // function to create markers for each step. final response = await directionsService.route(request); document.querySelector('#warnings_panel')!.innerHTML = - '${response.routes[0].warnings}'; + '${response.routes[0].warnings}'.toJS; directionsDisplay.directions = response; showSteps(response); } diff --git a/example/directions-waypoints/page.dart b/example/directions-waypoints/page.dart index aa794369..6204a7f0 100644 --- a/example/directions-waypoints/page.dart +++ b/example/directions-waypoints/page.dart @@ -55,5 +55,5 @@ void calcRoute() async { ..write('${leg.endAddress}
') ..write('${leg.distance!.text}

'); } - summaryPanel!.innerHTML = html.toString(); + summaryPanel!.innerHTML = html.toString().toJS; } diff --git a/example/distance-matrix/page.dart b/example/distance-matrix/page.dart index 6b9f8152..2a767cfb 100644 --- a/example/distance-matrix/page.dart +++ b/example/distance-matrix/page.dart @@ -56,7 +56,7 @@ void calculateDistances() async { '${origins[i]} to ${destinations[j]}: ${results[j].distance.text} in ${results[j].duration.text}
'); } } - document.getElementById('outputDiv')!.innerHTML = html.toString(); + document.getElementById('outputDiv')!.innerHTML = html.toString().toJS; } void addMarker(String location, {required bool isDestination}) async { diff --git a/example/places-autocomplete-hotelsearch/page.dart b/example/places-autocomplete-hotelsearch/page.dart index d9ad8039..b84059c6 100644 --- a/example/places-autocomplete-hotelsearch/page.dart +++ b/example/places-autocomplete-hotelsearch/page.dart @@ -193,9 +193,9 @@ void Function(MapMouseEvent) showInfoWindow( // Load the place information into the HTML elements used by the info window. void buildIWContent(PlaceResult place) { document.getElementById('iw-icon')!.innerHTML = - ''; + ''.toJS; document.getElementById('iw-url')!.innerHTML = - '${place.name}'; + '${place.name}'.toJS; document.getElementById('iw-address')!.textContent = place.vicinity; if (place.formattedPhoneNumber != null) { @@ -221,7 +221,7 @@ void buildIWContent(PlaceResult place) { } (document.getElementById('iw-rating-row')! as HTMLElement).style.display = ''; - document.getElementById('iw-rating')!.innerHTML = ratingHtml; + document.getElementById('iw-rating')!.innerHTML = ratingHtml.toJS; } } else { (document.getElementById('iw-rating-row')! as HTMLElement).style.display = diff --git a/example/places-queryprediction/page.dart b/example/places-queryprediction/page.dart index 3266dff8..c5c91e2a 100644 --- a/example/places-queryprediction/page.dart +++ b/example/places-queryprediction/page.dart @@ -27,6 +27,6 @@ void callback( for (final prediction in predictions!.toDart) { results.innerHTML = - '${results.innerHTML}
  • ${prediction!.description}
  • '; + '${results.innerHTML}
  • ${prediction!.description}
  • '.toJS; } } diff --git a/example/streetview-event/page.dart b/example/streetview-event/page.dart index 8527e8aa..d9c2e613 100644 --- a/example/streetview-event/page.dart +++ b/example/streetview-event/page.dart @@ -16,7 +16,7 @@ void main() { ); panorama.onPanoChanged.listen((_) { - document.getElementById('pano_cell')!.innerHTML = panorama.pano; + document.getElementById('pano_cell')!.innerHTML = panorama.pano.toJS; }); panorama.addListener( @@ -30,15 +30,15 @@ void main() { final links = panorama.links; for (var i = 0; i < links.toDart.length; i++) { linksTable.insertRow() - ..insertCell().innerHTML = 'Link: $i' - ..insertCell().innerHTML = links.toDart[i].description ?? ''; + ..insertCell().innerHTML = 'Link: $i'.toJS + ..insertCell().innerHTML = (links.toDart[i].description ?? '').toJS; } }.toJS, ); panorama.onPositionChanged.listen((_) { document.getElementById('position_cell')!.innerHTML = - '${panorama.position}'; + '${panorama.position}'.toJS; }); panorama.onPovChanged.listen((_) { diff --git a/pubspec.yaml b/pubspec.yaml index 76ff93a1..8d08463d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,19 +1,19 @@ name: google_maps -version: 8.0.0-dev.2 +version: 8.0.0-dev.3 description: > With that package you will be able to use Google Maps JavaScript API from Dart scripts. homepage: https://github.com/a14n/dart-google-maps environment: - sdk: '>=3.4.0 <4.0.0' + sdk: ^3.4.0 dependencies: meta: ^1.3.0 - web: ^0.5.0 + web: ">=0.5.1 <2.0.0" dev_dependencies: build_runner: ^2.4.0 build_web_compilers: ^4.0.0 collection: html: ^0.15.0 - http: ^0.13.0 + http: ^1.2.2 path: ^1.7.0 petitparser: ^6.0.2