getFloat abstract method

double getFloat(
  1. String key,
  2. double defaultValue
)

Gets a 32-bit floating-point value. Returns defaultValue if the key is missing or the stored type is not float. key Lookup key. defaultValue Value to return when not found or type mismatch. Returns Stored float or defaultValue.

Example:

// Retrieve float values with defaults
float userRating = _userStorage!.getFloat("user_rating", 0.0);
float temperature = _userStorage!.getFloat("temperature", 0.0);
float nonExistentFloat = _userStorage!.getFloat("non_existent_float", -1.0);
print("User rating: $userRating");
print("Temperature: $temperature");
print("Non-existent float: $nonExistentFloat");

Implementation

double getFloat(String key, double defaultValue);