mysql1_dart
mysql1_dart copied to clipboard
MySQL1 not closing connection
MySQL1 not closing connection in a Dart console application running on Windows 10, in debug mode. Find an example of the code structure below:
final conn = await MySqlConnection.connect(_settings);
Results results;
if (branches.isNotEmpty) {
for (var branch in branches) {
await conn.query('INSERT INTO branches (id, name) VALUES (?,?)', [branch.id, branch.name]);
}
}
await conn.close();
Thanks in advance.
You dont need an Await Func. Try it only conn.close();
Hi @berkayhh,
Thanks for the suggestion, but I am curious to why you think removing the await function would work. From my limited knowledge, an await will wait till the connection is closed before proceeding with the next line of code. Or am I missing something?
Best Regards