shared_preferences_module

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

shared preferences module

shared_preferences_module #
this module is used to create shared_preferences module for juneflow.
Installation #

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

june add shared_preferences_module
copied to clipboard
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');
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.

Related Products

More From This Creator