getBool method Null safety

bool? getBool(
  1. String key
)

Reads a value from persistent storage, throwing an exception if it's not a bool.

Implementation

bool? getBool(String key) => _preferenceCache[key] as bool?;