Этот репозиторий содержит Flutter плагины для платформы ОС Аврора.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Vitaliy Zarubin c352cd19a0 [license] Update license to BSD-3-Clause 1 year ago
..
lib [license] Update license to BSD-3-Clause 1 year ago
.gitignore [shared_preferences] Implement shared_preferences plugin. OMP#OS-16941 2 years ago
README.md [shared_preferences] Implement shared_preferences plugin. OMP#OS-16941 2 years ago
analysis_options.yaml [license] Update license to BSD-3-Clause 1 year ago
pubspec.yaml [license] Update license to BSD-3-Clause 1 year ago

README.md

shared_preferences_aurora

The Aurora implementation of [shared_preferences][https://pub.dev/packages/shared_preferences].

Usage

This package is not an endorsed implementation of shared_preferences. Therefore, you have to include path_provider_aurora alongside shared_preferences as dependencies in your pubspec.yaml file.

pubspec.yaml

dependencies:
  shared_preferences: ^2.1.1
  shared_preferences_aurora: ^0.0.0 # @todo Not published 

*.dart

import 'package:shared_preferences/shared_preferences.dart';

final SharedPreferences prefs = await SharedPreferences.getInstance();

// Save an integer value to 'counter' key.
await prefs.setInt('counter', 10);
// Save an boolean value to 'repeat' key.
await prefs.setBool('repeat', true);
// Save an double value to 'decimal' key.
await prefs.setDouble('decimal', 1.5);
// Save an String value to 'action' key.
await prefs.setString('action', 'Start');
// Save an list of strings to 'items' key.
await prefs.setStringList('items', <String>['Earth', 'Moon', 'Sun']);

// Try reading data from the 'counter' key. If it doesn't exist, returns null.
final int? counter = prefs.getInt('counter');
// Try reading data from the 'repeat' key. If it doesn't exist, returns null.
final bool? repeat = prefs.getBool('repeat');
// Try reading data from the 'decimal' key. If it doesn't exist, returns null.
final double? decimal = prefs.getDouble('decimal');
// Try reading data from the 'action' key. If it doesn't exist, returns null.
final String? action = prefs.getString('action');
// Try reading data from the 'items' key. If it doesn't exist, returns null.
final List<String>? items = prefs.getStringList('items');