getValue method

  1. @override
Duration? getValue(
  1. SharedPreferences preferences,
  2. String key
)
override

Retrieve a value associated with the key by using the preferences.

Implementation

@override
Duration? getValue(preferences, key) {
  final seconds = preferences.getInt(key);
  if (seconds == null) return null;
  if (seconds < 0) return null;

  return Duration(seconds: seconds);
}