'The getter 'secondaryContainer' isn't defined for the class 'ColorScheme'
When I import Syncfusion library to my project, these Errors showed me up.
My Flutter version is
2.4.0-4.0.pre,
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_gauges-19.4.53/lib/src/radial_gauge/pointers/marker_pointer_renderer.dart:631:34: Error: The getter 'secondaryContainer' isn't defined for the class 'ColorScheme'.
- 'ColorScheme' is from 'package:flutter/src/material/color_scheme.dart' ('/C:/src/flutter/packages/flutter/lib/src/material/color_scheme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'secondaryContainer'.
_themeData.colorScheme.secondaryContainer.withOpacity(0.8)
^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_gauges-19.4.53/lib/src/radial_gauge/pointers/marker_pointer_renderer.dart:642:36: Error: The getter 'secondaryContainer' isn't defined for the class 'ColorScheme'.
- 'ColorScheme' is from 'package:flutter/src/material/color_scheme.dart' ('/C:/src/flutter/packages/flutter/lib/src/material/color_scheme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'secondaryContainer'.
_themeData.colorScheme.secondaryContainer.withOpacity(0.12)
^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_gauges-19.4.53/lib/src/radial_gauge/pointers/range_pointer_renderer.dart:567:34: Error: The getter 'secondaryContainer' isn't defined for the class 'ColorScheme'.
- 'ColorScheme' is from 'package:flutter/src/material/color_scheme.dart' ('/C:/src/flutter/packages/flutter/lib/src/material/color_scheme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'secondaryContainer'.
_themeData.colorScheme.secondaryContainer.withOpacity(0.8)
^^^^^^^^^^^^^^^^^^
Solution 1:[1]
The properties primaryVariant and secondaryVariant were replaced with primaryContainer and secondaryContainer in Flutter v2.6.0-0.0.pre, so to use this version of the plugin you first need to update your Flutter version.
Solution 2:[2]
I have found that you are using the flutter stable SDK version 2.4.0-4.0-pre. Update your SDK to the latest version(>2.10.0) to solve this issue. If you wish to use the SDK version 2.4.0-4.0-pre only, use the Flutter Gauge - 19.4.48 version.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Luke Greenwood |
| Solution 2 | Praveen G |
