fluttercommunity / flutter_google_places

Google Places - Google places autocomplete widgets for flutter. No wrapper, use https://pub.dev/packages/google_maps_webservice. Maintainer: @juliansteenbakker
https://pub.dev/packages/flutter_google_places
Other
303 stars 415 forks source link

Google maps webservice error: The argument type 'String' can't be assigned to the parameter type 'Uri'. #152

Closed thealteria closed 2 years ago

thealteria commented 3 years ago

Getting this error while running the app:

../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/google_maps_webservice-0.0.19/lib/src/utils.dart:61:27: Error: The argument type 'String' can't be assigned to the parameter type 'Uri'.
 - 'Uri' is from 'dart:core'.
    return httpClient.get(url, headers: headers);

                          ^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/google_maps_webservice-0.0.19/lib/src/utils.dart:74:28: Error: The argument type 'String' can't be assigned to the parameter type 'Uri'.

 - 'Uri' is from 'dart:core'.
    return httpClient.post(url, body: body, headers: postHeaders);
                           ^
3 FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\hp\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\hp\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 16s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
hoc081098 commented 3 years ago

Because other packages depend on http: 0.13.0, I have updated to latest dependencies. Trying workaround https://github.com/hoc081098/flutter_google_places:

dependency_overrides:
  flutter_google_places:
    git:
      url: https://github.com/hoc081098/flutter_google_places.git
      ref: 7b6c2aa2053131142c0e48639823d24f312d00c1
thealteria commented 3 years ago

so I remove my flutter_google_places dependency from the dependencies and just put it in the pubspec.yaml like you mentioned?

hoc081098 commented 3 years ago

Just published as new name: https://pub.dev/packages/flutter_google_places_hoc081098. Only replace the importing

- import 'package:flutter_google_places/flutter_google_places.dart';
+ import 'package:flutter_google_places_hoc081098/flutter_google_places_hoc081098.dart';
KevMorelli commented 3 years ago

Can you test with version 0.3.0?

yaashwardhan commented 3 years ago

This is an easy fix. Just parse the String object with Uri().

for e.g Uri.parse(yourStringHere)