Well, I have a Cubit initialization in State<> class by value loaded from ObjectDB.
@override
void initState() {
super.initState();
final path = (Platform.isAndroid || Platform.isLinux) ? (Directory.current.path + '/theme.db') : '';
final storage = path == '' ? IndexedDBStorage('theme') : FileSystemStorage(path);
final db = SchemaDB<ColorThemeObjectdbSchema> (
storage,
(themeMap) => ColorThemeObjectdbSchema.fromMap(themeMap),
);
initTheme(db);
}
And during disposing of the state I need to update data of database. This is my implementation
@override
void dispose() {
db.cleanup();
db.insert({'themeObject': defaultTheme});
super.dispose();
}
But I am getting these errors
Undefined name 'db' • lib/widgets/states/my_home_page_state.dart:72:3 • undefined_identifier
Undefined name 'db' • lib/widgets/states/my_home_page_state.dart:73:3 • undefined_identifier
The 72nd and 73rd lines are
db.cleanup();
db.insert({'themeObject': defaultTheme});
Thank you for help!