main.dart 969 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import 'package:flustars/flustars.dart';
  2. import 'package:flutter/material.dart';
  3. void main() => runApp(new MyApp());
  4. class MyApp extends StatefulWidget {
  5. @override
  6. _MyAppState createState() => new _MyAppState();
  7. }
  8. class _MyAppState extends State<MyApp> {
  9. @override
  10. void initState() {
  11. super.initState();
  12. test();
  13. }
  14. void test() async {
  15. print("SpUtil: " + SpUtil.isInitialized().toString());
  16. SpUtil spUtil = await SpUtil.getInstance();
  17. //SpUtil.remove("username");
  18. print("SpUtil: " + SpUtil.isInitialized().toString());
  19. SpUtil.putString("username", "sky224");
  20. print("username: " + SpUtil.getString("username").toString());
  21. }
  22. @override
  23. Widget build(BuildContext context) {
  24. return new MaterialApp(
  25. home: new Scaffold(
  26. appBar: new AppBar(
  27. title: const Text('Plugin example app'),
  28. ),
  29. body: new Center(
  30. child: new Text('Running on: '),
  31. ),
  32. ),
  33. );
  34. }
  35. }