saveTime method

  1. @override
void saveTime(
  1. String? key,
  2. int? duration
)
override

save expiry time in milliseconds for this data key - the key used to store the data duration - duration of cache in seconds

Implementation

@override
void saveTime(String? key, int? duration) async {
  if (!isInitialized) await init();
  // duration = duration?.secondsToMilliseconds;
  if (key != null && key.isNotEmpty && duration != null && !duration.isNaN) {
    _prefs?.setInt('$key-time', duration);
  }
}