पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv2.0.10

native_shared_preferences

यह पैकेज shared_preferences पैकेज की नकल है, लेकिन कुंजियों में प्रारंभिक अंश नहीं है। पिछले नेटिव ऐप से डेटा को माइग्रेट करने के लिए उपयोग किया जाता है।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
180
लाइक
34
Pub अंक
130

पैकेज इंस्टॉल करें

flutter pub add native_shared_preferences

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

एक लाइटवेट, स्थायी कुंजी-मूल्य भंडारण समाधान के रूप में काम करने वाला एक Flutter/Dart पैकेज, shared_preferences पैकेज के समान है लेकिन कुंजी प्रारंभिक शब्दों के बिना। पुराने नेटिव एप्लिकेशन से डेटा के स्थानांतरण के लिए विशेष रूप से डिज़ाइन किया गया है, मूल कुंजी नामों को बनाए रखकर मौजूदा भंडारित डेटा के साथ बिना किसी बाधा के संगतता सुनिश्चित करता है। सरल, क्रॉस-प्लेटफॉर्म डेटा स्थायित्व की आवश्यकता वाले एप्लिकेशन के लिए आदर्श। यह पैकेज सभी प्रमुख प्लेटफॉर्म जैसे Android, iOS, Web, macOS, Windows और Linux का समर्थन करता है।

उपयोग

  • मूल ऐप्स से डेटा को प्रस्थान करना
  • उपयोगकर्ता पसंदीदा संग्रहित करना
  • सत्रों के बीच ऐप स्थिति को सुरक्षित रखना
  • प्लेटफॉर्म के अनुसार डेटा संग्रहण
  • सरल कुंजी-मान डेटा प्रबंधन

मुख्य विशेषताएँ

  • कोई की प्रारंभिक नहीं
  • प्रत्यक्ष डेटा माइग्रेशन समर्थन
  • बहुप्लेटफॉर्म संगतता
  • हल्का और तेज़
  • मौजूदा कोड के साथ आसान एकीकरण

इनके लिए उपयुक्त

  • पुराने ऐप माइग्रेशन
  • सरल डेटा स्थायित्व की आवश्यकता
  • क्रॉस-प्लेटफॉर्म एप्लिकेशन
  • सीधे कुंजी पहुँच की आवश्यकता वाले विकासकर्ता
  • महत्वपूर्ण नामस्थान संघर्षों से बचने वाले ऐप्स

विचार योग्य बातें

  • बड़े डेटासेट के लिए सुझाव नहीं है
  • मूलभूत कुंजी-मान भंडारण तक सीमित
  • कोई निर्मित एन्क्रिप्शन नहीं
  • सावधानी से की नामकरण की आवश्यकता होती है
  • मूल आधार प्लेटफ़ॉर्म स्टोरेज मैकेनिज्म पर निर्भर करता है

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

Migration Shared Preferences

===========

Codemagic build status

This plugin is a copy of the shared_preferences package but without the prefix in the keys. Is used to migrate the data from previous native app.

The issue is that flutter add a prefix to the keys when read and write. So we can not read our old keys. Also for Android you can now specify name of your resource file in android/app/src/main/res/values/strings.xml:

<resources>
    ...
    <string name="flutter_shared_pref_name">resource_name</string>
    ...
</resources>

ISSUE https://github.com/flutter/flutter/issues/52544

Only use this plugin when is needed get the shared preferences from previous native app version. For other situation use the official shared preferences package.

To manage the migration use this package https://pub.dev/packages/version_migration/

Installation

Add in pubspec:

native_shared_preferences: ^2.0.10

Usage

To use this plugin, add native_shared_preferences in your pubspec.yaml file

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

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

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

You can populate NativeSharedPreferences with initial values in your tests by running this code:

NativeSharedPreferences.setMockInitialValues (Map<String, dynamic> values);

श्रेणियाँ

निर्भरताएँ

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

  • cupertino_icons^1.0.6
  • file^7.0.0
  • meta^1.9.1
  • shared_preferences^2.2.2
  • shared_preferences_linux^2.3.2
  • shared_preferences_macos^2.0.5
  • shared_preferences_platform_interface^2.3.1
  • shared_preferences_web^2.2.1
  • shared_preferences_windows^2.3.2

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट