getDateTime method

DateTime getDateTime(
  1. String key, {
  2. DateTime? defaultValue,
  3. bool local = true,
})

Implementation

DateTime getDateTime(String key,
    {DateTime? defaultValue, bool local = true}) {
  defaultValue ??= DateTime.now();
  if (jsonObject.containsKey(key)) {
    defaultValue = DateTime.tryParse(jsonObject[key]);
  }
  return local ? defaultValue!.toLocal() : defaultValue!;
}