local_cache_sync 1.0.0
local_cache_sync: ^1.0.0 copied to clipboard
Cache json map to local file with Dart:io. Read cahce with sync api.
example/lib/main.dart
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 {
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() {
getTemporaryDirectory().then((uri) {
LocalCacheSync.instance.setCachePath(uri.path);
});
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.green,
),
home: HomePage(),
);
}
}