setDateTime method

  1. @override
Future<void> setDateTime(
  1. String key,
  2. DateTime value
)
override

Saves a DateTime value with the given key.

This method stores a DateTime value in the storage by converting it to milliseconds since epoch format, associating it with the specified key. If a value already exists for this key, it will be replaced.

Parameters:

  • key - The unique identifier for the DateTime value.
  • value - The DateTime value to store.

Returns a Future that completes when the DateTime has been successfully stored.

Throws:

Implementation

@override
Future<void> setDateTime(String key, DateTime value) =>
    setInt(key, value.isUtc ? value.millisecondsSinceEpoch : value.toUtc().millisecondsSinceEpoch);