【发布时间】:2021-01-12 13:28:15
【问题描述】:
void checkIfAllValsAreIn(
{ Map<> map,
bool isBool,
Function() callback}) async {...}
如何使这些命名参数中的任何一个在调用时成为必需参数?
【问题讨论】:
标签: flutter dart methods parameters named
void checkIfAllValsAreIn(
{ Map<> map,
bool isBool,
Function() callback}) async {...}
如何使这些命名参数中的任何一个在调用时成为必需参数?
【问题讨论】:
标签: flutter dart methods parameters named
让他们@required
import 'package:meta/meta.dart';
void checkIfAllValsAreIn(
{ @required Map<> map,
@required bool isBool,
@required Function() callback}) async {...}
【讨论】:
尝试在正文中添加:
assert(isBool != null);
【讨论】: