sqlite3.dart
sqlite3.dart copied to clipboard
Use finalizers to automatically dispose databases and statements
In Dart 2.17, we can attach a Finalizer to objects to invoke a callback when they become unreachable. We can use this to automatically dispose databases and prepared statements if a user forgets to dispose them manually.
One issue is that the finalizer callback can't use the database itself, it would have to use a finalization token still providing all the information necessary to fully dispose the object.