title: Not closing the database with Flutter's SQFlite?
body: <p>I'm trying to understand database operations using the <a href="https://pub.dartlang.org/packages/sqflite" rel="noreferrer">SQFlite plugin</a> for Flutter. In the <a href="https://github.com/tekartik/sqflite/blob/master/doc/usage_recommendations.md" rel="noreferrer">usage recommendation docs</a>, the author says:</p>
  
  <blockquote>
    <p>The API is largely inspired from Android ContentProvider where a
    typical SQLite implementation means opening the database once on the
    first request and keeping it open.</p>
    
    <p>Personally I have one global reference Database in my Flutter
    application to avoid lock issues. Opening the database should be safe
    if called multiple times.</p>
    
    <p>Keeping a reference only in a widget can cause issues with hot reload
    if the reference is lost (and the database not closed yet).</p>
  </blockquote>
  
  <p>Does this mean I make a singleton class (like <a href="https://medium.com/flutter-community/using-sqlite-in-flutter-187c1a82e8b" rel="noreferrer">here</a>) that opens a database connection and then I never close it? That is, I never do this:</p>
  
  <pre><code>await database.close();
  </code></pre>
  
  <p>I've run into concurrency issues in the past with Android SQLite (as described <a href="https://stackoverflow.com/a/19996964/3681880">here</a>) so I generally used a content provider to get around that. However, I was just using it without really understanding what the content provider was doing behind the scenes. Does keeping around a single connection to the database do the same thing? Do I need to close the DB when the app exits? <a href="https://stackoverflow.com/questions/2493331/what-are-the-best-practices-for-sqlite-on-android#comment36956769_19996964">This user</a> seems to think that it doesn't matter.</p>