Bloc: [WEB] Runtime error on "bloc != null is not true" error at flutter_web project

Created on 31 Jul 2019  ·  4Comments  ·  Source: felangel/bloc

Describe the bug
Runtime error on "bloc != null is not true".

To Reproduce
Steps to reproduce the behavior:

  1. Implement flutter login example from HERE.
  2. Run serve command
  3. You will see the error on browser.

Expected behavior
Shows the login page without errors.

Screenshots
Screen Shot 2019-07-31 at 15 06 51.

*Logs *
flutter analyze
info • This function has a return type of 'StatelessWidget', but doesn't end with a return statement • lib/main.dart:56:18 • missing_return
info • The parameter 'bloc' is required • lib/widgets/login_form.dart:26:12 • missing_required_param.

flutter doctor -v
[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.5 18F132, locale en-TW)
• Flutter version 1.7.8+hotfix.4 at /Users/zane.chen/development/flutter
• Framework revision 20e59316b8 (12 days ago), 2019-07-18 20:04:33 -0700
• Engine revision fee001c93f
• Dart version 2.4.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
• Android SDK at /Users/zane.chen/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.3, Build version 10G8
• CocoaPods version 1.7.3

[✓] iOS tools - develop for iOS devices
• ios-deploy 1.9.4

[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 37.0.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

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

[!] Connected device
! No devices available

! Doctor found issues in 1 category.

Additional context
Add any other context about the problem here.

Did I do something wrong with the tutorial guide?

question

All 4 comments

It seems that the package flutter_bloc I installed in pubspec.yml causes this issue.

name: flutter_web.examples.hello_world

environment:
  # You must be using Flutter >=1.5.0 or Dart >=2.3.0
  sdk: '>=2.3.0-dev.0.1 <3.0.0'

dependencies:
  flutter_web: any
  flutter_web_ui: any
  flutter_bloc:
    git:
      url: https://github.com/felangel/bloc
      path: packages/flutter_bloc
      ref: flutter_web
  equatable: ^0.3.0

dev_dependencies:
  build_runner: ^1.6.5
  build_web_compilers: ^2.1.4

dependency_overrides:
  flutter_web:
    path: ../../packages/flutter_web
  flutter_web_ui:
    path: ../../packages/flutter_web_ui

I know that flutter_web is still in experimental stage, but is there any workaround that could make it works.

Hi @u2633 👋
Thanks for opening an issue! I just rebased master onto the flutter_web branch so it should be compatible with flutter_bloc v0.20.0. Can you re-test and let me know if you're still having the issue? Thanks! 👍

Hi @felangel
Thanks for your quick reply. The issue has gone, but it prompts other errors when pressing login button.

Screen Shot 2019-08-01 at 13 35 12
Screen Shot 2019-08-01 at 13 41 05

@u2633 can you share a link to your repo? Thanks! 👍

Was this page helpful?
0 / 5 - 0 ratings