redux_persist_flutter 0.5.0 redux_persist_flutter: ^0.5.0 copied to clipboard
Redux Persist Flutter Integration
redux_persist_flutter #
Flutter Storage Engine for redux_persist
.
Can either save to shared_preferences
(default, recommended), or your
application document directory.
Usage #
var persistor = new Persistor<State>(
// ...
storage: new FlutterStorage("my-app"),
);
PersistorGate
#
If you want to wait until rendering you app until the state is loaded,
use the PersistorGate
:
@override
Widget build(BuildContext context) {
return new PersistorGate(
persistor: persistor,
builder: (context) => MyApp(),
);
}
If you want to display a loading/slash screen while loading,
pass a widget to render to the loading
param of PersistorGate
:
new PersistorGate(
persistor: persistor,
loading: SlashScreen(), // !!!
builder: (context) => MyApp(),
);
Locations #
By default, it saves to FlutterSaveLocation.sharedPreference
(shared_preferences
, recommended).
You can also save to your application document directory
by using FlutterSaveLocation.documentFile
:
new FlutterStorage("my-app", location: FlutterSaveLocation.documentFile)
Features and bugs #
Please file feature requests and bugs at the issue tracker.