connect method

  1. @override
Future<bool> connect()
override

Implementation

@override
Future<bool> connect() async {
  try {
    _db = await Connection.open(endpoint);
  } catch (e) {
    print('Error connecting to PostgreSQL: $e');
    return false;
  }

  try {
    lastId = (await _db.execute(
          'SELECT MAX(id) as mid FROM fractal',
        ))
            .first
            .first as int? ??
        0;
  } catch (e) {}

  return true;
}