getLong method
Gets a 64-bit integer value.
Returns defaultValue if the key is missing or the stored type is not long.
key Lookup key.
defaultValue Value to return when not found or type mismatch.
Returns Stored int64 or defaultValue.
Example:
// Retrieve long values with defaults
long regTimestamp = _userStorage!.getLong("registration_timestamp", 0);
long lastLogin = _userStorage!.getLong("last_login_timestamp", 0);
long nonExistentLong = _userStorage!.getLong("non_existent_long", -1);
print("Registration timestamp: $regTimestamp");
print("Last login timestamp: $lastLogin");
print("Non-existent long: $nonExistentLong");
Implementation
@override
int getLong(String key, int defaultValue) {
final _getLongFfi = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction<
Int64 Function(Pointer<Void>, Pointer<Void>, Int64),
int Function(Pointer<Void>, Pointer<Void>, int)
>('navigine_sdk_flutter_KeyValueStorage_getLong__Key_DefaultValue'));
final _keyHandle = navigine_sdk_flutter_String_ToFfi(key);
final _defaultValueHandle = navigine_sdk_flutter_int_ToFfi(defaultValue);
final _handle = this.handle;
final __resultHandle = _getLongFfi(_handle, _keyHandle, _defaultValueHandle);
navigine_sdk_flutter_String_ReleaseFfiHandle(_keyHandle);
navigine_sdk_flutter_int_ReleaseFfiHandle(_defaultValueHandle);
final _result = navigine_sdk_flutter_int_FromFfi(__resultHandle);
navigine_sdk_flutter_int_ReleaseFfiHandle(__resultHandle);
return _result;
}