A flutter app mid-level cache framework for Android/iOS/macOS.
flutter shared_preferences packages <=> mid_level_cache <=> production logic
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):
dependencies:
mid_level_cache:
git:
url: [email protected]:nick45chen/mid_level_cache_flutter.git
ref: master
Now in your Dart code, you can use. And the best way to use it is to initialize it when the application starts.
import 'package:mid_level_cache/mid_level_cache.dart';
void main() {
runApp(MainApp());
}
class MainApp extends StatefulWidget {
@override
_MainAppState createState() => _MainAppState();
}
class _MainAppState extends State<MainApp> {
@override
Widget build(BuildContext context) {
return FutureBuilder<MCache>(
// initialize
future: MCache.preInit(),
builder: (BuildContext context, AsyncSnapshot<MCache> snapshot) {
return MaterialApp(
home: rootWidget,
);
},
);
}
}