flutter city_pickers插件会提示 textColor: widget.itemFontColor ?? theme.accentColor,
最新的flutter使用city_pickers插件会提示 textColor: widget.itemFontColor ?? theme.accentColor如何解决
Launching lib\main.dart on PGCM10 in debug mode...
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
/C:/Users/htzhanglong/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/city_pickers-1.2.1/lib/src/cities_selector/cities_selector.dart:116:48: Error: The getter 'accentColor' isn't defined for the class 'ThemeData'.
- 'ThemeData' is from 'package:flutter/src/material/theme_data.dart' ('/F:/flutter_windows/flutter_windows_3.10.3-stable/flutter/packages/flutter/lib/src/material/theme_data.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'accentColor'.
textColor: widget.itemFontColor ?? theme.accentColor,
^^^^^^^^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
解决方法:
参考:https://github.com/hanxu317317/city_pickers/issues/162
dependencies:
city_pickers: # FIXME: Use latest version instead after the commit release.
git:
url: https://github.com/hanxu317317/city_pickers
ref: 8a702e52d52e17df9995353748b3dfe088f27de9