LocalData.dart 522 B

12345678910111213141516171819
  1. import 'package:flutter/material.dart';
  2. import 'package:shared_preferences/shared_preferences.dart';
  3. /// Description: LocalData
  4. /// Time : 08/18/2023 Friday
  5. /// Author : liuyuqi.gov@msn.cn
  6. class LocalData {
  7. static SharedPreferences? _sharedPreferences;
  8. static init() async {
  9. if (_sharedPreferences == null) {
  10. _sharedPreferences = await SharedPreferences.getInstance();
  11. debugPrint("init LocalData");
  12. }
  13. }
  14. static SharedPreferences? getInstance() {
  15. return _sharedPreferences;
  16. }
  17. }