title: Avoid static get definition
body: <p>I created DatasetDatabase to handle some database function calls as following:</p>
  <pre><code>class DatasetDatabase{
    final Future&lt;Database&gt; database;
  
    DatasetDatabase(this.database);
  
    Future loadDatasetTable() async{
      final Database db = await database;
      final List&lt;Map&lt;String, dynamic&gt;&gt; table = await db.query('datasets');
      print(table[0]['dataset']);
      var _datasetList = jsonDecode(table[0]['dataset']).map&lt;Dataset&gt;((e) =&gt; Dataset.fromJson(e)).toList();
      return _datasetList;
    }
  </code></pre>
  <p>At the same time I have DatabaseService class where I would like to get database and instantiate databases. However, I can't simply pass database as parameter as it can't be accessed in the initializer.</p>
  <pre><code>class DatabaseService{
  
    Future&lt;Database&gt; get database async {
      Database _database = await openDatabase(
        join(await getDatabasesPath(), 'caralgo_database.db'),
        onCreate: (db, version) {
          db.execute(
              &quot;CREATE TABLE datasets(id INTEGER PRIMARY KEY, dataset TEXT)&quot;
          );
          db.execute(
              &quot;CREATE TABLE unitConfigs(id INTEGER PRIMARY KEY, unitConfig TEXT)&quot;
          );
        },
        version: 1,
      );
      return _database;
    }
  
    final DatasetDatabase datasetDatabase = DatasetDatabase(database);
    final UnitConfigDatabase unitConfigDatabase = UnitConfigDatabase(database);
  }
  </code></pre>
  <p>One of the solutions is to make get database static, but I would like to avoid it. Is there any other way to do it?</p>