FLUTTER ECOSYSTEM

lesnitsky/localstorage

📦 फ्लटर के लिए स्थानीय भंडारण

flutter_localstorage प्रोजेक्ट कवर
Stars
305
Forks
67
अंतिम पुश (UTC)
18 मार्च 2025
प्रोजेक्ट स्थिति
सक्रिय
Andrei Lesnitsky GitHub avatar
GITHUB User

Andrei Lesnitsky ↗

SWE @FlutterFlow

FlutterFlowPoland, Gdańsk
भाषाएँC++CMakeDartRubySwiftHTMLCKotlinObjective-C

तकनीकी विषय

इस रिपॉज़िटरी के पैकेज

उपयोग की गई निर्भरताएँ

निर्भरता सूची 6 आइटम

मूल README

यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।

README खोलें / बंद करें

LocalStorage

LocalStorage for Flutter.

[!IMPORTANT]
LocalStorage is not intended to store large amounts or sensitive data.

Installation

flutter pub add localstorage

or add dependency to pubspec.yaml manually

dependencies:
  localstorage: ^5.0.0

API docs

LocalStorage API documentation

Usage

import 'package:flutter/material.dart';
import 'package:localstorage/localstorage.dart';

late final ValueNotifier<int> notifier;

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await initLocalStorage();

  notifier = ValueNotifier(int.parse(localStorage.getItem('counter') ?? '0'));
  notifier.addListener(() {
    localStorage.setItem('counter', notifier.value.toString());
  });

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: ValueListenableBuilder<int>(
            valueListenable: notifier,
            builder: (context, value, child) {
              return Text('Pressed $value times');
            },
          ),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            notifier.value++;
          },
          child: const Icon(Icons.add),
        ),
      ),
    );
  }
}

Contributors

License

MIT