shared_preferences_module 1.0.1 copy "shared_preferences_module: ^1.0.1" to clipboard
shared_preferences_module: ^1.0.1 copied to clipboard

this module is used to create shared_preferences module for juneflow.

pub package

juneflow_github

shared_preferences_module #

this module is used to create shared_preferences module for juneflow.

Installation #

  1. If the juneflow project doesn't exist, please create it by following this guide.
  2. open terminal in the juneflow project root directory, enter the following command.
june add shared_preferences_module

Usage #

// Save an integer value to 'counter' key.
await prefs.setInt('counter', 10);
// Save an boolean value to 'repeat' key.
await prefs.setBool('repeat', true);
// Save an double value to 'decimal' key.
await prefs.setDouble('decimal', 1.5);
// Save an String value to 'action' key.
await prefs.setString('action', 'Start');
// Save an list of strings to 'items' key.
await prefs.setStringList('items', <String>['Earth', 'Moon', 'Sun']);

// Try reading data from the 'counter' key. If it doesn't exist, returns null.
final int? counter = prefs.getInt('counter');
print(counter); // 10

// Try reading data from the 'repeat' key. If it doesn't exist, returns null.
final bool? repeat = prefs.getBool('repeat');
print(repeat); // true

// Try reading data from the 'decimal' key. If it doesn't exist, returns null.
final double? decimal = prefs.getDouble('decimal');
print(decimal); // 1.5

// Try reading data from the 'action' key. If it doesn't exist, returns null.
final String? action = prefs.getString('action');
print(action); // Start

// Try reading data from the 'items' key. If it doesn't exist, returns null.
final List<String>? items = prefs.getStringList('items');
print(items); // [Earth, Moon, Sun]

// Remove data for the 'counter' key.
await prefs.remove('counter');
1
likes
95
points
44
downloads

Publisher

unverified uploader

Weekly Downloads

this module is used to create shared_preferences module for juneflow.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, go_router, june_flow_util, shared_preferences

More

Packages that depend on shared_preferences_module