FLUTTER ECOSYSTEM

marchdev-tk/cross_local_storage

मोबाइल (Android/iOS), वेब और डेस्कटॉप (Windows, macOS, Linux) के लिए SharedPreferences वрапर।

cross_local_storage प्रोजेक्ट कवर
Stars
10
Forks
5
अंतिम पुश (UTC)
6 अग॰ 2025
प्रोजेक्ट स्थिति
सक्रिय
MarchDev Toolkit GitHub avatar
GITHUB Organization

MarchDev Toolkit ↗

Code with ease via MarchDev Toolkit

भाषाएँC++DartCMakeRubyHTMLSwiftCObjective-C

तकनीकी विषय

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

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

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

मूल README

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

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

cross_local_storage

Build Pub GitHub GitHub stars

Wraps NSUserDefaults (on iOS and macOS), SharedPreferences (on Android), LocalStorage (on Web) and JSON file (on Windows and Linux), providing a persistent store for simple data. Data is persisted to disk asynchronously. Neither platform can guarantee that writes will be persisted to disk after returning and this plugin must not be used for storing critical data.

Getting Started

In order to use this plugin, add dependency in the pubspec.yaml:

cross_local_storage: any

or

cross_local_storage:
  git:
    url: https://github.com/marchdev-tk/cross_local_storage

Add an import to dart file:

import 'package:cross_local_storage/cross_local_storage.dart';
Example
import 'package:flutter/material.dart';
import 'package:cross_local_storage/cross_local_storage.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      body: Center(
      child: RaisedButton(
        onPressed: _incrementCounter,
        child: Text('Increment Counter'),
        ),
      ),
    ),
  ));
}

_incrementCounter() async {
  LocalStorageInterface prefs = await LocalStorage.getInstance();
  int counter = (prefs.getInt('counter') ?? 0) + 1;
  print('Pressed $counter times.');
  await prefs.setInt('counter', counter);

Feature requests and Bug reports

Feel free to post a feature requests or report a bug here.