prefs 3.0.1 prefs: ^3.0.1 copied to clipboard
A Library Package that utilizes the plugin, shared_preferences, to store and read an app’s preferences in both the Android and the iOS platform.
import 'package:flutter/material.dart';
import 'package:prefs/prefs.dart';
void main() {
runApp(MaterialApp(
home: Scaffold(
body: Center(
child: RaisedButton(
onPressed: _incrementCounter,
child: Text('Increment Counter'),
),
),
),
));
}
_incrementCounter() async {
int counter = await Prefs.getIntF('counter');
counter = counter + 1;
print('Pressed $counter times.');
Prefs.setInt('counter', counter);
}