ConnectionWrapper constructor Null safety

ConnectionWrapper(
  1. String cid,
  2. ConnectionSetting settings,
  3. RemoveConnection removeMe
)

Implementation

ConnectionWrapper(this.cid, this.settings, this.removeMe) {
  connection = PostgreSQLConnection(
      settings.host, settings.port, settings.dbName,
      username: settings.userName, password: settings.password);
  timeoutTimer = Timer.periodic(Duration(seconds: 60), (timer) {
    final ts = DateTime.now().millisecondsSinceEpoch;
    if (ts - idleTs > 3600000) {
      timer.cancel();
      connection.close().then((value) {
        removeMe(cid);
      });
    }
  });
}