I got these error in my flutter code I've tried (flutter clean - flutter pub get - flutter upgrade - cache repair) all of it didn't work

124

Here is what the error means, you made a CupertinoNavigationBar and are passing into it an actionsForegroundColor, but doing that is not allowed as of version 1.22.

You can read more about it on flutter 1.22 changes

the new way to pass the equivalent parameter is by adding a CupertinoTheme somewhere above your CupertinoNavigationBar (I believe CupertinoApp does this automatically if you pass the theme parameter?) and passing a Cupertino theme data object with the primary color value.

CupertinoTheme(
  data: CupertinoThemeData(
    primaryColor: data?.actionsForegroundColor,
  ),
  child: CupertinoNavigationBar(),
);

or on CupertinoApp

CupertinoApp(
  theme: CupertinoThemeData(
    primaryColor: data?.actionsForegroundColor,
  ),
  home: ...
);
Share:
124
Admin
Author by

Admin

Updated on January 02, 2023

Comments

  • Admin
    Admin over 1 year

    PS C:\Flutter\app\groceries-shopping-flutter-app> flutter run
    Using hardware rendering with device AOSP on IA Emulator. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering". Launching lib\main.dart on AOSP on IA Emulator in debug mode... ../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-0.72.0/lib/src/platform_app_bar.dart:202:9: Error: No named parameter with the name 'actionsForegroundColor'. actionsForegroundColor: data?.actionsForegroundColor, ^^^^^^^^^^^^^^^^^^^^^^ ../../flutter/packages/flutter/lib/src/cupertino/nav_bar.dart:245:9: Context: Found this candidate, but the arguments don't match. const CupertinoNavigationBar({ ^^^^^^^^^^^^^^^^^^^^^^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-0.72.0/lib/src/platform_app_bar.dart:222:7: Error: No named parameter with the name 'actionsForegroundColor'. actionsForegroundColor: data?.actionsForegroundColor, ^^^^^^^^^^^^^^^^^^^^^^ ../../flutter/packages/flutter/lib/src/cupertino/nav_bar.dart:245:9: Context: Found this candidate, but the arguments don't match. const CupertinoNavigationBar({ ^^^^^^^^^^^^^^^^^^^^^^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.18.1/lib/src/picture_provider.dart:50:59: Error: No named parameter with the name 'nullOk'. context != null ? Localizations.localeOf(context, nullOk: true) : null, ^^^^^^ ../../flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match. static Locale localeOf(BuildContext context) { ^^^^^^^^

    FAILURE: Build failed with an exception.

    • Where: Script 'C:\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1070

    • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

    Process 'command 'C:\Flutter\flutter\bin\flutter.bat'' 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 55s Running Gradle task 'assembleDebug'... 58.6s Exception: Gradle task assembleDebug failed with exit code 1