beacon_settings

Creator: coderz1093

Last updated:

0 purchases

beacon_settings Image
beacon_settings Images

Languages

Categories

Add to Cart

Description:

beacon settings

Beacon Settings #



A light-weight companion package to state_beacon that provides a simple way to manage settings for a dart application.
Example usage #
For more complex examples (and examples using Flutter), see the Cookbook.
void main() {
// Create a new instance of `MySettings` with an in-memory storage.
final settings = MySettings(InMemoryStorage());

// Print the current value of `isAwesome`. Since the `defaultValue` is true,
// this is `true` on first access.
print(settings.isAwesome.value); // Prints `true`

// Change the value. In this case, use `state_beacon`s built-in `toggle` method.
settings.isAwesome.toggle();

// Print the new value of `isAwesome`.
print(settings.isAwesome.value); // Prints `false`
}

class MySettings extends Settings {
MySettings(super.storage);

late final isAwesome = setting(
key: 'isAwesome',
decode: boolDecoder(defaultValue: true),
encode: boolEncoder(),
).value;
}
copied to clipboard
Features #

Simple: Define a setting with a key, a decoder, and an encoder.
Type-safe: Decoders and encoders are type-safe.
Flexible: Use the built-in decoders and encoders or define your own.
Extensible: Define your own Storage implementation.
Testable: Use the built-in InMemoryStorage for testing.
Compatible: Plug & play with other Beacons (see derivedSetting) and storage implementations like SharedPreferences.

Installation #
dart pub add beacon_settings
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.