local_cache_sync 3.1.1 local_cache_sync: ^3.1.1 copied to clipboard
Cache json map to local file with Dart:io. Read cache with sync api.
import 'package:example/pages/homePage.dart';
import 'package:flutter/material.dart';
import 'package:local_cache_sync/local_cache_sync.dart';
import 'package:path_provider/path_provider.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
LocalCacheSync.instance.setCachePath(
await getTemporaryDirectory(),
'example_app/',
);
runApp(MyApp());
}
class MyApp extends StatefulWidget {
// This widget is the root of your application.
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.green,
),
home: HomePage(),
);
}
}