web icon indicating copy to clipboard operation
web copied to clipboard

Error: The getter 'hsFuture' isn't defined for the class '_EventStreamSubscription<T>'.

Open syah125 opened this issue 10 months ago • 2 comments

Yesterday i got no problem when running my Flutter Web but today I got this error. I don't know what root cause of this error. Even I change the page and run the flutter web in blank page, i still got this error. Thank you.

Launching lib/main.dart on Chrome in debug mode...
../../.pub-cache/hosted/pub.dev/web-0.5.1/lib/src/helpers/events/streams.dart:196:25: Error: The getter 'hsFuture' isn't defined for the class '_EventStreamSubscription<T>'.
 - '_EventStreamSubscription' is from 'package:web/src/helpers/events/streams.dart' ('../../.pub-cache/hosted/pub.dev/web-0.5.1/lib/src/helpers/events/streams.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'hsFuture'.
    final emptyFuture = hsFuture<void>.value();
                        ^^^^^^^^
../../.pub-cache/hosted/pub.dev/web-0.5.1/lib/src/helpers/events/streams.dart:196:25: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
    final emptyFuture = hsFuture<void>.value();
                        ^

flutter doctor -v result:

`[✓] Flutter (Channel stable, 3.19.6, on macOS 14.3.1 23D60 darwin-x64, locale en-US)
    • Flutter version 3.19.6 on channel stable at /Users/alif/src/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (6 days ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/alif/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.88.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.86.0

[✓] Connected device (3 available)
    • iPhone 8 Plus (mobile) • 4C669F31-EC87-457C-B697-07078FB3B3A1 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)        • macos                                • darwin-x64     • macOS 14.3.1 23D60 darwin-x64
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 124.0.6367.62

[✓] Network resources
    • All expected network resources are available.

• No issues found!`

syah125 avatar Apr 24 '24 06:04 syah125

I'm not sure where that code is coming from. The related code is here: https://github.com/dart-lang/web/blob/main/lib/src/helpers/events/streams.dart#L196 which doesn't use "hsFuture", and the git blame doesn't show that code ever existing. Maybe try clearing your pub cache and trying again?

srujzs avatar Apr 24 '24 16:04 srujzs

I had the same issue and clearing the pub cache was the fix. Thanks @srujzs

dbadrian avatar Jun 14 '24 16:06 dbadrian