main.dart 851 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. SpUtil spUtil = await SpUtil.getInstance();
  16. //SpUtil.remove("username");
  17. SpUtil.putString("username", "sky224");
  18. print("username: " + SpUtil.getString("username").toString());
  19. }
  20. @override
  21. Widget build(BuildContext context) {
  22. return new MaterialApp(
  23. home: new Scaffold(
  24. appBar: new AppBar(
  25. title: const Text('Plugin example app'),
  26. ),
  27. body: new Center(
  28. child: new Text('Running on: '),
  29. ),
  30. ),
  31. );
  32. }
  33. }