Flutter not able to run, get_navigation & theme error

ε祈祈猫儿з 提交于 2020-12-03 13:23:18

问题


i'm actually trying to run my app but i'm stucked with that error :

Running "flutter pub get" in riverpod_stacked_app...
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
../../.pub-cache/hosted/pub.dartlang.org/get-3.15.0/lib/get_navigation/src/extension_navigation.dart:235:37: Error: No named parameter with the name 'shadowThemeOnly'.
    final theme = Theme.of(context, shadowThemeOnly: true);
                                    ^^^^^^^^^^^^^^^
../../development/flutter/packages/flutter/lib/src/material/theme.dart:119:20: Context: Found this candidate, but the arguments don't match.
  static ThemeData of(BuildContext context) {
                   ^^
../../.pub-cache/hosted/pub.dartlang.org/get-3.15.0/lib/get_navigation/src/extension_navigation.dart:431:43: Error: No named parameter with the name 'shadowThemeOnly'.
      theme: Theme.of(key.currentContext, shadowThemeOnly: true),
                                          ^^^^^^^^^^^^^^^
../../development/flutter/packages/flutter/lib/src/material/theme.dart:119:20: Context: Found this candidate, but the arguments don't match.
  static ThemeData of(BuildContext context) {
                   ^^


FAILURE: Build failed with an exception.

* Where:
Script '/Users/Alex/development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 900

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/Alex/development/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 19s
Exception: Gradle task assembleDebug failed with exit code 1

I don't understand why it can't build. I don't see the link between those 2 errors :

  • get_navigation
  • something with the theme from material.dart And my actual motivation to use riverpod, stacked_services and firebase.

Here is the result of flutter doctor -v :

[✓] Flutter (Channel master, 1.24.0-8.0.pre.98, on Mac OS X 10.15.7 19H2 darwin-x64, locale fr-FR)
    • Flutter version 1.24.0-8.0.pre.98 at /Users/Alex/development/flutter
    • Framework revision ef4ec09a06 (6 hours ago), 2020-11-05 08:02:13 -0800
    • Engine revision bf259226b2
    • Dart version 2.12.0 (build 2.12.0-21.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/Alex/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✗] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

[✓] Android Studio (version 4.1)
    • 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 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (1 available)
    • sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)

! Doctor found issues in 1 category.

And here is my dependencies in pubspeck.yaml

version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.0
  stacked_services:
  auto_route: 0.6.9
  hooks_riverpod: 0.12.1
  flutter_hooks:

  firebase_core: 0.5.1
  firebase_auth: 0.18.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner:
  auto_route_generator:

Any ideas ? I've trie to clean up my dependencies and reinstall. Also i start a blank project with flutter counter app and it runs properly.


回答1:


I also had this problem today after upgrading Flutter.

I was only able to solve it after I deleted that method parameter from the file that triggered the error. You'll have to delete it in two places.

Search in .pub-cache/hosted/pub.dartlang.org/get-3.15.0/lib/get_navigation/src/extension_navigation.dart for

Theme.of(key.currentContext, shadowThemeOnly: true)

As replace it with

Theme.of(key.currentContext)

This is probably cause by the stacked_services dependency that uses the get: ^3.15.0 dependency




回答2:


this is already fixed by getx in 16.1. Pub upgrade will do it

https://github.com/jonataslaw/getx/issues/762




回答3:


you need to remove only

 ThemeData theme = Theme.of(key.currentContext, shadowThemeOnly: false);
    if (theme != null) {
      bottomSheet = new Theme(data: theme, child: bottomSheet);
    }
    return bottomSheet;

form your .pubcach folder.



来源:https://stackoverflow.com/questions/64706160/flutter-not-able-to-run-get-navigation-theme-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!