0

I am trying to connect dart with a MySQL database But I'm getting this Error: Unsupported operation: RawSocket

import 'dart:async';

import 'package:mysql1/mysql1.dart';

Future main() async {
  // Open a connection (testdb should already exist)
  final conn = await MySqlConnection.connect(ConnectionSettings(
      host: 'localhost', port: 3306, user: 'root', db: 'testdb'));
  var results = await conn
      .query('select * from sample');
  for (var row in results) {
    print('${row[0]}');
  }
// Finally, close the connection
  await conn.close();
}
  • https://stackoverflow.com/questions/54933232/exception-unsupported-operation-rawsocket-constructor-dart-with-sqljocky5-2 – John Joe Feb 14 '20 at 02:59
  • Does this answer your question? [EXCEPTION: Unsupported operation: RawSocket constructor (Dart with sqljocky5: ^2.2.1)](https://stackoverflow.com/questions/54933232/exception-unsupported-operation-rawsocket-constructor-dart-with-sqljocky5-2) – Ken White Feb 14 '20 at 03:30
  • code runs on the server on which mysql is present or runs on mobile. As you tagged flutter it creates confusion. – Dev Feb 14 '20 at 04:19

0 Answers0