add sp and support save the width and height
This commit is contained in:
1 parent
1c53032b3f
commit
595ee6fd6a
9 files changed
+187
-10
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class SP {
|
||||
static late SharedPreferences prefs;
|
||||
|
||||
static Future<void> init() async {
|
||||
prefs = await SharedPreferences.getInstance();
|
||||
}
|
||||
|
||||
static double getDouble(String key, [double def = 0]) {
|
||||
return prefs.getDouble(key) ?? def;
|
||||
}
|
||||
|
||||
static Future<bool> setDouble(String key, double value) {
|
||||
return prefs.setDouble(key, value);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user