getDateTime abstract method

Future<DateTime?> getDateTime(
  1. String key, {
  2. bool isUtc = false,
})

Retrieves a DateTime value by its key.

This method fetches a DateTime value previously stored using setDateTime. The DateTime is stored as an ISO 8601 string and reconstructed when retrieved. If no value exists for the given key, or the stored value cannot be parsed as a DateTime, this method returns null.

Parameters:

  • key - The unique identifier of the DateTime value to retrieve.
  • isUtc - Optional. If true, the returned DateTime will be in UTC timezone. If false (default), it will be in the local timezone.

Returns a Future that completes with the stored DateTime value if found, or null if the key doesn't exist or the value cannot be parsed as a DateTime.

Throws:

Implementation

Future<DateTime?> getDateTime(String key, {bool isUtc = false});