fluttercommunity/flutter_google_places

Flutter stable channel issue - Error: The method 'ancestorStateOfType' isn't defined for the class 'BuildContext'.

adam-weissert opened this issue · 1 comments

In the newest stable branch of flutter the build will fail with this error

../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_google_places-0.2.6/lib/src/flutter_google_places.dart:74:15: Error: The method 'ancestorStateOfType' isn't defined for the class 'BuildContext'.
 - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('../../Development/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorStateOfType'.
      context.ancestorStateOfType(const TypeMatcher<PlacesAutocompleteState>());

Here's flutter doctor with it as well:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.4, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Chrome - develop for the web
[✓] Android Studio
[✓] VS Code (version 1.55.0)
[✓] Connected device (2 available)

flutter pub deps -- --style=compact

Dart SDK 2.12.2
Flutter SDK 2.0.4
atlascrm 1.0.73+73

dependencies:
- charts_flutter 0.10.0 [charts_common collection flutter intl logging meta]
- confetti 0.5.5 [flutter random_color vector_math]
- cupertino_icons 1.0.2
- dan_barcode_scan 1.0.1 [protobuf flutter]
- date_range_picker 1.0.7 [flutter]
- datetime_picker_formfield 1.0.0 [flutter intl]
- dio 3.0.10 [http_parser path]
- firebase_auth 0.20.1 [meta firebase_core firebase_core_platform_interface firebase_auth_platform_interface firebase_auth_web flutter]
- firebase_core 0.7.0 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- firebase_messaging 8.0.0-dev.15 [meta flutter firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_cache_manager 2.1.2 [flutter path_provider uuid http path sqflite pedantic clock file rxdart image]
- flutter_google_places 0.2.6 [flutter rxdart google_maps_webservice http]
- flutter_launcher_icons 0.8.1 [image args yaml path]
- flutter_masked_text 0.8.0 [flutter]
- flutter_pdfview 1.1.0 [flutter]
- flutter_pusher 1.0.2 [json_annotation flutter]
- flutter_secure_storage 4.1.0 [meta flutter]
- fluttertoast 8.0.3 [flutter flutter_web_plugins]
- google_maps_flutter 0.5.33 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface]
- google_sign_in 4.5.9 [google_sign_in_platform_interface flutter meta google_sign_in_web]
- graphql_flutter 4.0.1 [graphql gql_exec flutter meta path_provider path connectivity hive]
- image 2.1.19 [archive xml meta]
- image_picker 0.6.7+22 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- intl 0.16.1 [path]
- loading_animations 2.2.0 [flutter]
- maps_launcher 2.0.0 [flutter flutter_web_plugins url_launcher]
- multi_image_picker 4.8.00 [flutter meta]
- path_provider 1.6.28 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
- permission_handler 5.1.0+2 [flutter meta permission_handler_platform_interface]
- photo_view 0.11.1 [flutter]
- search_map_place 0.3.0 [flutter google_maps_flutter http]
- searchable_dropdown 1.1.3 [flutter]
- table_calendar 2.3.3 [flutter intl simple_gesture_detector]
- unicorndial 1.1.5 [flutter]
- url_launcher 6.0.3 [flutter url_launcher_platform_interface url_launcher_linux url_launcher_macos url_launcher_windows url_launcher_web]
- webview_flutter 2.0.4 [flutter]
- xml 4.5.1 [collection convert meta petitparser]

dev dependencies:
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]

transitive dependencies:
- archive 2.0.13 [crypto args path]
- args 1.6.0
- async 2.5.0 [collection]
- boolean_selector 2.1.0 [source_span string_scanner]
- characters 1.1.0
- charcode 1.2.0
- charts_common 0.10.0 [collection intl logging meta vector_math]
- clock 1.1.0
- collection 1.15.0
- connectivity 2.0.2 [flutter meta connectivity_platform_interface connectivity_macos connectivity_for_web]
- connectivity_for_web 0.3.1+4 [connectivity_platform_interface flutter_web_plugins flutter]
- connectivity_macos 0.1.0+7 [flutter]
- connectivity_platform_interface 1.0.6 [flutter meta plugin_platform_interface]
- convert 2.1.1 [charcode typed_data]
- crypto 2.1.5 [collection convert typed_data]
- fake_async 1.2.0 [clock collection]
- ffi 1.0.0
- file 6.1.0 [meta path]
- firebase_auth_platform_interface 3.1.0 [flutter meta firebase_core plugin_platform_interface]
- firebase_auth_web 0.3.3 [flutter flutter_web_plugins meta http_parser intl firebase_core firebase_core_web firebase_auth_platform_interface js]
- firebase_core_platform_interface 3.0.1 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.1+3 [firebase_core_platform_interface flutter flutter_web_plugins meta js]
- firebase_messaging_platform_interface 1.0.0-dev.10 [flutter meta firebase_core plugin_platform_interface]
- firebase_messaging_web 0.1.0-dev.6 [flutter flutter_web_plugins meta firebase_core firebase_core_web firebase_messaging_platform_interface js service_worker]
- fixnum 1.0.0
- flutter_plugin_android_lifecycle 1.0.11 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- google_maps_flutter_platform_interface 1.2.0 [flutter meta plugin_platform_interface stream_transform collection]
- google_maps_webservice 0.0.19 [http meta]
- google_sign_in_platform_interface 1.1.2 [flutter meta quiver]
- google_sign_in_web 0.9.2 [google_sign_in_platform_interface flutter flutter_web_plugins meta js]
- gql 0.12.4 [source_span meta collection]
- gql_dedupe_link 1.0.10 [meta gql_exec gql_link async]
- gql_error_link 0.1.1-alpha+1601131172858 [async gql_exec gql_link meta]
- gql_exec 0.2.5 [gql meta collection]
- gql_http_link 0.3.2 [meta gql gql_exec gql_link http http_parser]
- gql_link 0.3.1 [meta gql gql_exec]
- gql_transform_link 0.1.5 [gql_exec gql_link]
- graphql 4.0.1 [meta path gql gql_exec gql_link gql_http_link gql_transform_link gql_error_link gql_dedupe_link hive normalize http collection websocket rxdart uuid_enhanced]
- hive 1.4.4+1 [meta crypto]
- http 0.12.2 [http_parser path pedantic]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- image_picker_platform_interface 1.1.6 [flutter meta http plugin_platform_interface]
- js 0.6.3
- json_annotation 3.1.1
- logging 1.0.1
- matcher 0.12.10 [stack_trace]
- meta 1.3.0
- normalize 0.4.7 [gql meta]
- path 1.8.0
- path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_macos 0.0.4+8 [flutter]
- path_provider_platform_interface 1.0.4 [flutter meta platform plugin_platform_interface]
- path_provider_windows 0.0.5 [path_provider_platform_interface meta path flutter ffi win32]
- pedantic 1.11.0
- permission_handler_platform_interface 2.0.2 [flutter meta plugin_platform_interface]
- petitparser 3.1.0 [meta]
- platform 3.0.0
- plugin_platform_interface 1.0.3 [meta]
- process 4.2.1 [file path platform]
- protobuf 2.0.0 [fixnum]
- quiver 2.1.5 [matcher meta]
- random_color 1.0.5 [flutter]
- rxdart 0.24.1
- service_worker 0.2.4 [js]
- simple_gesture_detector 0.1.6 [flutter]
- sky_engine 0.0.99
- source_span 1.8.0 [charcode collection path term_glyph]
- sqflite 2.0.0+3 [flutter sqflite_common path]
- sqflite_common 2.0.0+2 [synchronized path meta]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- stream_transform 1.2.0
- string_scanner 1.1.0 [charcode source_span]
- synchronized 3.0.0
- term_glyph 1.2.0
- test_api 0.2.19 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0 [collection]
- url_launcher_linux 2.0.0 [flutter]
- url_launcher_macos 2.0.0 [flutter]
- url_launcher_platform_interface 2.0.1 [flutter plugin_platform_interface]
- url_launcher_web 2.0.0 [url_launcher_platform_interface meta flutter flutter_web_plugins]
- url_launcher_windows 2.0.0 [flutter]
- uuid 2.2.2 [crypto convert]
- uuid_enhanced 3.0.2 [crypto convert collection]
- vector_math 2.1.0
- websocket 0.0.5
- win32 2.0.5 [ffi]
- xdg_directories 0.1.2 [meta path process]
- yaml 2.2.1 [charcode collection string_scanner source_span]

I'm aware of the changes in #140 and have tried this suggested fix as well as this one no avail.

I've upgraded the package to v0.3.0 and any of its dependencies, which resolved this issue, so I'm closing this issue