Describe the bug
The intellij Bloc Code Generator plugin (https://plugins.jetbrains.com/plugin/12129-bloc-code-generator) isn't generating the bloc file properly, it is missing the state parameter in mapEventToState.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
mapEventToState should have both event and state parameters, but the generated function only has an event parameter.
Screenshots
Below is a screenshot of the bloc generated using the steps above:
*Logs *
Run flutter analyze
and attach any output of that command below.
Roberts-iMac:Eorzean-Workshop robertfarley$ flutter analyze
Analyzing Eorzean-Workshop...
error • 'TestBloc.mapEventToState' ('(TestEvent) → Stream
1 issue found. (ran in 3.0s)
Paste the output of running flutter doctor -v
here.
Roberts-iMac:Eorzean-Workshop robertfarley$ flutter doctor -v
[✓] Flutter (Channel master, v1.5.9-pre.179, on Mac OS X 10.14.5 18F131a, locale en-GB)
• Flutter version 1.5.9-pre.179 at /Users/robertfarley/Documents/Flutter/flutter
• Framework revision d6c4e36693 (2 days ago), 2019-05-08 10:12:40 -0400
• Engine revision 1604a413ad
• Dart version 2.3.0 (build 2.3.0-dev.0.5 8143450941)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/robertfarley/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /Users/robertfarley/Library/Android/sdk
• 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-1248-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2, Build version 10E125
• ios-deploy 1.9.4
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 34.0.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.1.2)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 35.3.3
• Dart plugin version 191.7141.49
[✓] VS Code (version 1.33.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.0.0
[✓] Connected device (1 available)
• SM G950F • 988a5c483959454b43 • android-arm64 • Android 8.0.0 (API 26)
• No issues found!
Hi @RobPFarley 👋
Thanks for opening an issue!
Regarding your question, I believe if you update to the latest version of bloc/flutter_bloc (0.13.0) your errors will be resolved. Let me know if that helps 👍
Thanks for the fast reply. So it looks like we now get the current state from the instance variable in the bloc rather than the mapEventToState method?
No problem and yup exactly 👍