79487386

Date: 2025-03-05 18:38:53
Score: 0.5
Natty:
Report link

@Kars mentioned that we need delayed() after query(). In my case, I needed delayed() BFFORE query().

 final connection = await MySqlConnection.connect(new ConnectionSettings(
    host: 'localhost',
    port: 3306,
    user: 'u1',
    password: 'p2',
    db: 'db_temp',
  ));
  await Future.delayed(Duration(seconds: 2));          // need this

  var results = await connection.query('select * from roles');

  print(results);
  for (var row in results) {
    print('${row[0]}');
  }

  // Finally, close the connection
  await connection.close();
Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Kars
  • Looks like a comment (1):
  • High reputation (-1):
Posted by: Dustin Sun