init static method

Future<void> init()

Implementation

static Future<void> init() async {
  if (_db != null) {
    return;
  }

  try {
    var databasesPath = await getDatabasesPath();
    String _path = p.join(databasesPath, 'api_cache_db.db');
    _db = await openDatabase(
      _path,
      version: _version,
      onCreate: onCreate,
      onUpgrade: onUpgrade,
    );
  } catch (ex) {
    print(ex);
  }
}