skip to Main Content

I’m getting this error after updating to 3.10, and I don’t reference accentColor in code. I assume it’s one of the libraries that use this line. How do I check which one it is?

Error:

: Error: The getter 'accentColor' isn't defined for the class 'ThemeData'.
rectangle_indicator.dart:17
- 'ThemeData' is from 'package:flutter/src/material/theme_data.dart' ('../../flutter/packages/flutter/lib/src/material/theme_data.dart').
theme_data.dart:1
Try correcting the name to the name of an existing getter, or defining a getter or field named 'accentColor'.
    final borderColor = this.borderColor ?? Theme.of(context).accentColor;
                                                              ^^^^^^^^^^^
: Error: The getter 'accentColor' isn't defined for the class 'ThemeData'.
triangle_indicator.dart:20
- 'ThemeData' is from 'package:flutter/src/material/theme_data.dart' ('../../flutter/packages/flutter/lib/src/material/theme_data.dart').
theme_data.dart:1
Try correcting the name to the name of an existing getter, or defining a getter or field named 'accentColor'.
          color: color ?? theme.accentColor,
                                ^^^^^^^^^^^

Dependencies:

dependencies:
  flutter:
    sdk: flutter

  firebase_core: ^2.8.0
  firebase_analytics: ^10.1.6
  firebase_performance: ^0.9.0+16
  firebase_crashlytics: ^3.0.17

  shared_preferences: ^2.0.15
  provider: ^6.0.4
  url_launcher: ^6.1.6
  flutter_boxicons: ^3.0.0
  material_design_icons_flutter: ^6.0.7096

  flutter_localizations:
    sdk: flutter
  flutter_fortune_wheel: ^1.2.0
  dynamic_color: ^1.6.3
  flutter_hooks: ^0.18.6

  google_mobile_ads: ^3.0.0
  purchases_flutter: ^4.11.1
  font_awesome_flutter: ^10.4.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.1
  flutter_native_splash: ^2.2.19
  dependency_validator: ^3.0.0

3

Answers


  1. The accentColor is removed in the new version of flutter.
    You can use colorScheme.secondayColor instead of accentcolor.

    Login or Signup to reply.
  2. It says rectangle_indicator.dart:17 and triangle_indicator.dart:20 which you can see comes from the flutter_fortune_wheel library.

    Login or Signup to reply.
  3. Try running flutter clean in the Android Studio terminal, and Do Invalidate caches and restart the IDE.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search