DurationField constructor
DurationField({
- required String name,
- Duration? initialValue = defaultDuration,
- @Deprecated('Fields should not be aware of their context') void onChanged(
- BuildContext context,
- Duration? value
Implementation
DurationField({
required super.name,
super.initialValue = defaultDuration,
@Deprecated('Fields should not be aware of their context') super.onChanged,
}) : super(
type: FieldType.duration,
codec: FieldCodec(
toParam: (value) => value.inMilliseconds.toString(),
toValue: (param) {
return param == null
? null
: Duration(
milliseconds: int.tryParse(param) ?? 0,
);
},
),
);