title: Sqlite in flutter, how database assets work
body: <p>I am looking at this (<a href="https://github.com/tekartik/sqflite/blob/master/doc/opening_asset_db.md" rel="nofollow noreferrer">https://github.com/tekartik/sqflite/blob/master/doc/opening_asset_db.md</a>) for populating data that is already formatted and need for the app, for read functionality only.</p>
  <p>So my understanding of creating an SQLite database when we already have all the information in an outside CSV file is to, create the class models in a .dart file in my app, such as</p>
  <pre><code>class User {
  
    int id;
    String _firstName;
    String _lastName;
    String _dob;
  
    User(this._firstName, this._lastName, this._dob);
  
    User.map(dynamic obj) {
      this._firstName = obj[&quot;firstname&quot;];
      this._lastName = obj[&quot;lastname&quot;];
      this._dob = obj[&quot;dob&quot;];
    }
  
    String get firstName =&gt; _firstName;
  
    String get lastName =&gt; _lastName;
  
    String get dob =&gt; _dob;
  
    Map&lt;String, dynamic&gt; toMap() {
      var map = new Map&lt;String, dynamic&gt;();
      map[&quot;firstname&quot;] = _firstName;
      map[&quot;lastname&quot;] = _lastName;
      map[&quot;dob&quot;] = _dob;
      return map;
    }
    void setUserId(int id) {
      this.id = id;
    }
  }
  </code></pre>
  <p>then if I have a CSV file with all the user information inside of it (with values that correspond to the user class), could I be using the database asset to have that fill out the information and then call to it inside of the flutter app? I realize there are probably many ways to go about this, but What exactly is the .db file storing, and how is it formatted? Can i implement a .csv file into this .db file?</p>