dart 在构造函数flutter中指定可选的关键字参数

f3temu5u  于 2023-02-17  发布在  Flutter
关注(0)|答案(1)|浏览(145)
final Widget child;
  final Colors color;

  const FlexibleContainer({required this.child, Colors? this.color, Key? key}) : super(key: key);

我在此遇到错误。color -parameter type Colors is incompatible with field type Colors

x4shl7ld

x4shl7ld1#

final Widget child;
  final Color? color;

  const NotificationHandler({required this.child, this.color, Key? key});

相关问题