GetStorageBridge class
A bridge class to interact with the native storage methods using MethodChannel. Example usage:
void main() async {
final storage = GetStorageBridge();
// Write a value
await storage.write('myKey', 'myValue');
// Read a value
final value = await storage.read('myKey', 'defaultValue');
print('Read value: \$value');
// Check if a key exists
final exists = await storage.contains('myKey');
print('Key exists: \$exists');
// Remove a key
await storage.remove('myKey');
// Clear all keys
await storage.clear();
}
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → Future< void> - Clears all keys from storage.
-
contains(
String key) → Future< bool> - Checks if a key exists in storage.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read<
T> (String key, T defaultValue) → Future< T> - Reads a value from storage.
-
remove(
String key) → Future< void> - Removes a key from storage.
-
toString(
) → String -
A string representation of this object.
inherited
-
write<
T> (String key, T value) → Future< void> - Writes a value to storage.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- channel → const MethodChannel