您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

24 行
561 B

  1. //ignore: unused_import
  2. import 'dart:convert';
  3. import 'package:shared_preferences/shared_preferences.dart';
  4. class PrefUtils {
  5. static SharedPreferences? _sharedPreferences;
  6. PrefUtils() {
  7. SharedPreferences.getInstance().then((value) {
  8. _sharedPreferences = value;
  9. });
  10. }
  11. Future<void> init() async {
  12. _sharedPreferences ??= await SharedPreferences.getInstance();
  13. print('SharedPreference Initialized');
  14. }
  15. ///will clear all the data stored in preference
  16. void clearPreferencesData() async {
  17. _sharedPreferences!.clear();
  18. }
  19. }