class Lessons {
final int? id;
final String? title;
final List<Resources> resources;
Lessons({
required this.id,
required this.title,
required this.resources,
});
}
class Resources extends Equatable {
final int? id;
final String? question;
final String? answer;
bool? bookmark;
Resources({
required this.id,
required this.question,
required this.answer,
required this.bookmark,
});
}
//storing in secured storage
static Future<void> setLessonData(jsonData) async {
final jsonDataEncoded = jsonEncode(jsonData);
await storage.write(key: lessonsData, value: jsonDataEncoded);
}
static Future<DataResponse<List<Lessons>>> getLessonDataFromLocal() async {
final jsonModel = await storage.read(key: lessonsData);
final jsonData = jsonDecode(jsonModel.toString());
final items = List.from(jsonData["lessons"]);
lessonsList = items.map((e) => Lessons.fromJson(e)).toList();
return DataResponse.success(data: lessonsList);
}
-these are my models, and have saved them using the secured storage flutter. How do i change just the bookmark and save it to secured storage?
i was able to change the bookmark but was unable to save it dynamically to secured storage.