getDateTime method

Future<DateTime> getDateTime(
  1. String prefKey
)

Implementation

Future<DateTime> getDateTime (String prefKey) async {
  final SharedPreferences prefs = await SharedPreferences.getInstance();
  Pref p = getPref (prefKey);
  if (p == null) {
    return null;
  } else if (prefs.getString(prefKey) == null) {
    return DateTime.parse(p.defVal.toString());
  } else {
    return DateTime.parse(prefs.getString(prefKey));
  }
}