settings_gen 1.0.4
settings_gen: ^1.0.4 copied to clipboard

Code generator for MobX that adds support for annotating your code with @observable, @computed, @action and also creating SettingsStore classes.

pub package pub package

settings_gen #

Code generator for settings_manager built for use with SharedPreferences. This will add Streams and ValueNotifiers for each field.

$> cd $YOUR_PROJECT_DIR
$> flutter packages pub run build_runner build

Example #

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:settings_manager/settings_manager.dart';
import 'package:shared_preferences/shared_preferences.dart';

part 'settings.g.dart';

class Settings = SettingsBase with _$Settings;

abstract class SettingsBase with SettingsStore {
  @BoolSetting(defaultValue: false)
  bool darkMode;

  @StringSetting(defaultValue: 'none')
  String userId;

  @IntSetting(defaultValue: 0)
  int counterValue;

  @DoubleSetting(defaultValue: 0)
  double radialValue;

  @StringListSetting(defaultValue: [])
  List<String> savedItems;
}

0
likes
50
pub points
3%
popularity

Publisher

rodydavis.com

Code generator for MobX that adds support for annotating your code with @observable, @computed, @action and also creating SettingsStore classes.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

analyzer, build, build_resolvers, flutter, meta, path, settings_manager, source_gen

More

Packages that depend on settings_gen