getFloat method
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
@override
double getFloat(String key, double defaultValue) {
final _getFloatFfi = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
Float Function(Pointer<Void>, Pointer<Void>, Float),
double Function(Pointer<Void>, Pointer<Void>, double)
>('navigine_sdk_flutter_KeyValueStorage_getFloat__Key_DefaultValue'));
final _keyHandle = navigine_sdk_flutter_String_ToFfi(key);
final _defaultValueHandle = navigine_sdk_flutter_double_ToFfi(defaultValue);
final _handle = this.handle;
final __resultHandle = _getFloatFfi(_handle, _keyHandle, _defaultValueHandle);
navigine_sdk_flutter_String_ReleaseFfiHandle(_keyHandle);
navigine_sdk_flutter_double_ReleaseFfiHandle(_defaultValueHandle);
final _result = navigine_sdk_flutter_double_FromFfi(__resultHandle);
navigine_sdk_flutter_double_ReleaseFfiHandle(__resultHandle);
return _result;
}