Hello!
I'm developing a devtools plugin which offers functionality to clear/remove a local sqlite file on web and io platforms.
The problem I'm having is that when the app does a window.location.reload() when a request to reset the database is performed, the devtools plugin doesn't have the chance to know about this event, so we cannot update UI to remove this database from a list for example.
I tried using ServiceManager.connectedState but it doesn't seem to fit here, as the VM service session is the same one.
My implementation is as follows. It works correctly on IO platforms but not on web.
app side
void handleResetDbRequest() {
// Delete database file / web indexeddb
await resetDb();
// Let the plugin know that it needs to refresh the list of databases in the devtools UI
postEvent('notify-db-update');
// it does nothing on io and `window.location.reload()` on web
await afterDbReset();
}
devtools plugin
Future<void> requestDbReset() async {
// request a db reset to the app
await serviceManager.callServiceExtensionOnMainIsolate(...);
// Perform a hot restart of the app
await serviceManager.performHotRestart();
}
Hello!
I'm developing a devtools plugin which offers functionality to clear/remove a local sqlite file on web and io platforms.
The problem I'm having is that when the app does a
window.location.reload()when a request to reset the database is performed, the devtools plugin doesn't have the chance to know about this event, so we cannot update UI to remove this database from a list for example.I tried using
ServiceManager.connectedStatebut it doesn't seem to fit here, as the VM service session is the same one.My implementation is as follows. It works correctly on IO platforms but not on web.
app side
devtools plugin