fromJson static method

Duration? fromJson(
  1. Map<String, dynamic>? json
)

Returns a new Duration instance and imports its values from json if it's non-null, null if json is null.

Implementation

static Duration? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return Duration(
    hours: json[r'hours']?.toDouble(),
    minutes: json[r'minutes']?.toDouble(),
    seconds: json[r'seconds'],
  );
}