I am using the latest version of the package , everything works perfectly until I close the app or use hot reload, the data vanishes .I've tried several solutions (calling storage.ready in a future builder) etc
But still no persistent data , this my code , inspired from the example provided with the package
return FutureBuilder(
future: storage.ready,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.data == null) {
return Center(
child: CircularProgressIndicator(),
);
}
List<Qrqc>? list = [];
var liststorage;
if (!initialized) {
liststorage = storage.getItem('todos');
if (liststorage != null) {
list = liststorage.cast<Qrqc>();
}
initialized = true;
}
return ListView.builder(
physics: const BouncingScrollPhysics(),
shrinkWrap: true,
itemCount: list!.length,
itemBuilder: (BuildContext context, int index) {
return Column(
children: [
ConditionalBuilder(
condition: list![index].status == 'INIT',
builder: (context) => QrqcBody(
child: QrqcCard(
child: QrqcCardBody(
color: Colors.orange,
text: list![index].status,
leading: QrqcCardLeaing(
imgPath: "assets/icons/unknown.png"),
trailing: QrqcCardtrailing(
text: list[index].progress.toString(),
percent: list[index].progress.toString(),
),
title: list[index].id.toString(),
subtitle: list[index].title,
chlidren: [
QrqcDetailsCardFirstRow(
product:
list[index].productName ?? 'no product',
role: list[index].role ?? "no role",
),
const SizedBox(height: 10),
QrqcDetailsCardSecondRow(
perim:
list[index].perimeterName ?? "no perim",
date: convertDateTimeDisplay(
list[index].createdAt!),
),
const SizedBox(height: 10),
],
)),
),
fallback: null),
ConditionalBuilder(
condition: list[index].status == 'SUBMITTED',
builder: (context) => QrqcBody(
child: QrqcCard(
child: QrqcCardBody(
color: Colors.blue,
text: 'SUB',
leading: QrqcCardLeaing(
imgPath: "assets/icons/unknown.png"),
trailing: QrqcCardtrailing(
text: list![index].progress.toString(),
percent: list[index].progress.toString(),
),
title: list[index].id.toString(),
subtitle: list[index].title,
chlidren: [
QrqcDetailsCardFirstRow(
product:
list[index].productName ?? 'no product',
role: list[index].role ?? "no role",
),
const SizedBox(height: 10),
QrqcDetailsCardSecondRow(
perim:
list[index].perimeterName ?? "no perim",
date: convertDateTimeDisplay(
list[index].createdAt!),
),
const SizedBox(height: 10),
],
)),
),
fallback: null),
ConditionalBuilder(
condition: list[index].status == 'VALIDATED',
builder: (context) => QrqcBody(
child: QrqcCard(
child: QrqcCardBody(
color: Colors.green,
text: 'VALID',
leading: QrqcCardLeaing(
imgPath: "assets/icons/unknown.png"),
trailing: QrqcCardtrailing(
text: list![index].progress.toString(),
percent: list[index].progress.toString(),
),
title: list[index].id.toString(),
subtitle: list[index].title,
chlidren: [
QrqcDetailsCardFirstRow(
product: 'fromoff',
role: list[index].role ?? "no role",
),
const SizedBox(height: 10),
QrqcDetailsCardSecondRow(
perim:
list[index].perimeterName ?? "no perim",
date: convertDateTimeDisplay(
list[index].createdAt!),
),
const SizedBox(height: 10),
],
)),
),
fallback: null),
ConditionalBuilder(
condition: list[index].status == 'ESCALATED',
builder: (context) => QrqcBody(
child: QrqcCard(
child: QrqcCardBody(
color: Colors.red,
text: 'ESCAL',
leading: QrqcCardLeaing(
imgPath: "assets/icons/unknown.png"),
trailing: QrqcCardtrailing(
text: list![index].progress.toString(),
percent: list[index].progress.toString(),
),
title: list[index].id.toString(),
subtitle: list[index].title,
chlidren: [
QrqcDetailsCardFirstRow(
product:
list[index].productName ?? 'no product',
role: list[index].role ?? "no role",
),
const SizedBox(height: 10),
QrqcDetailsCardSecondRow(
perim:
list[index].perimeterName ?? "no perim",
date: convertDateTimeDisplay(
list[index].createdAt!),
),
const SizedBox(height: 10),
],
)),
),
fallback: null)
],
);
});
});
How can I fix the issue for I've been stuck for a while now . Thank you so much for considering helping me