sunday_get_storage 2.1.1 copy "sunday_get_storage: ^2.1.1" to clipboard
sunday_get_storage: ^2.1.1 copied to clipboard

A fast, extra light and synchronous key-value storage written entirely in Dart

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sunday_get_storage/sunday_get_storage.dart';

void main() async {
  await GetStorage.init();
  runApp(App());
}

class Controller extends GetxController {
  final box = GetStorage();
  bool get isDark => box.read('darkmode') ?? false;
  ThemeData get theme => isDark ? ThemeData.dark() : ThemeData.light();
  void changeTheme(bool val) => box.write('darkmode', val);
}

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final controller = Get.put(Controller());
    return Obx(() {
      return MaterialApp(
        theme: controller.theme,
        home: Scaffold(
          appBar: AppBar(title: Text("Get Storage")),
          body: Center(
            child: SwitchListTile(
              value: controller.isDark,
              title: Text("Touch to change ThemeMode"),
              onChanged: controller.changeTheme,
            ),
          ),
        ),
      );
    });
  }
}
3
likes
150
points
127
downloads

Publisher

verified publisherisunday.app

Weekly Downloads

A fast, extra light and synchronous key-value storage written entirely in Dart

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, get, path_provider

More

Packages that depend on sunday_get_storage