Build fail: Provider.stream(Stream, {}) conflicts to Provider.stream(BuildContext)
Build log
Compiler message:
file:///Users/sunbreak/lib/flutter/.pub-cache/hosted/pub.flutter-io.cn/provide-1.0.1/lib/provide.dart:220:11: Error: Can't declare a member that conflicts with an inherited one.
factory Provider.stream(Stream<T> stream, {T initialValue}) =>
^
file:///Users/sunbreak/lib/flutter/.pub-cache/hosted/pub.flutter-io.cn/provide-1.0.1/lib/provide.dart:192:13: Context: This is the inherited member.
Stream<T> stream(BuildContext context);
^
Compiler terminated unexpectedly.
Reproduce
- flutter create hello
- add "provide ^1.0.1" to dependencies in pubspec.yaml
- add "import 'package:provide/provide.dart';" to main.dart
- flutter build apk --release/debug OR flutter build ios --release/debug --no-codesign
Flutter Doctor
bogon:~ sunbreak$ flutter doctor -v [✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.14.3 18D109, locale en-CN) • Flutter version 1.0.0 at /Users/sunbreak/lib/flutter • Framework revision 5391447fae (3 months ago), 2018-11-29 19:41:26 -0800 • Engine revision 7375a0f414 • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3) • Android SDK at /Users/sunbreak/lib/android-sdk-macosx • Android NDK location not configured (optional; useful for native profiling support) • Platform android-28, build-tools 28.0.3 • ANDROID_HOME = /Users/sunbreak/lib/android-sdk-macosx • Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin/java • Java version Java(TM) SE Runtime Environment (build 1.8.0_181-b13) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 10.1, Build version 10B61 • ios-deploy 1.9.4 • CocoaPods version 1.5.3
[!] Android Studio (version 3.3.1) • Android Studio at /Users/sunbreak/Applications/JetBrains Toolbox/Android Studio.app/Contents ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. ✗ Unable to find bundled Java version. • Try updating or re-installing Android Studio.
[✓] IntelliJ IDEA Ultimate Edition (version 2018.3.4) • IntelliJ at /Users/sunbreak/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app • Flutter plugin version 33.1.2 • Dart plugin version 183.5901
[✓] VS Code (version 1.31.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 2.23.0
[✓] Connected device (1 available) • sunbreak-iPhoneX • fea92a66dcc76d390a73c235d7de105436174b38 • ios • iOS 12.1.2
! Doctor found issues in 2 categories.
I've tried several times:
## It works on the second build
flutter clean && flutter build ios/apk --debug || flutter build ios/apk --debug
## Doesn't work
flutter clean && flutter build ios/apk --release || flutter build ios/apk --release
## Doesn't work
flutter build aot --debug --target-platform android-arm64 || flutter build aot --debug --target-platform android-arm64
## Doesn't work
flutter build aot --debug --target-platform ios || flutter build aot --debug --target-platform ios
Considering release build using AOT not JIT build mode, it seems to be related to AOT build mode of Dart for Flutter.
I have the same problem ; do you resolved it?
I have the same problem ; do you resolved it?
I've no idea what to do
in my case.
flutter packages get and flutter run
the flutter's version is not the same may cause the problem
I also have the exact same fault
Migrate to AndroidXhere or updaten flutter 1.2+