DurationField constructor

DurationField({
  1. required String name,
  2. Duration? initialValue = defaultDuration,
  3. @deprecated void onChanged(
    1. BuildContext context,
    2. Duration? value
    )?,
})

Implementation

DurationField({
  required super.name,
  super.initialValue = defaultDuration,
  @deprecated 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,
                  );
          },
        ),
      );