Clever Settings Flutter

style: very good analysis Powered by Mason License: MIT

A flutter package that provides useful flutter utilities for clever_settings.

Installation 💻

❗ In order to start using Clever Settings Flutter you must have the Flutter SDK installed on your machine.

Add clever_settings_flutter and clever_settings to your pubspec.yaml:

dependencies:
  clever_settings:
  clever_settings_flutter:

Install it:

flutter packages get

Initialization

Before you can start using Clever Settings, you need to initialize it first. Call the init function once at the start of your application:

await CleverSettingsFlutter.init();

This will initialize Hive and open the settings database. If you want to configure Hive yourself, you can use CleverSettings.open() after initializing Hive.

Usage 🚀

This will only focus on the additional features of clever_settings_flutter. The readme for the basic usage of clever_settings can be found here.

SettingsValueBuilder

The SettingsValueBuilder is a widget used for building other widgets that depend on a SettingsValue object. It rebuilds whenever the value of the setting changes.

Example usage:

class Settings {
  static const mySetting =
      SettingsValue<bool>(name: 'mySetting', defaultValue: true);
}

...

SettingsValueBuilder(
  setting: Settings.mySetting,
  builder: (context, value, child) {
    return Text(value.toString());
  },
),

Libraries

clever_settings_flutter
Library providing flutter utilities for clever_settings.