Mysql
 SQL >> Database >  >> RDS >> Mysql

Come connettersi a un database MySQL con Dart?

Puoi usare SQLJocky per connetterti a MySQL. Aggiungi

dependencies:
  sqljocky: 0.0.4

al tuo pubspec.yaml ed esegui pub install. Ora puoi connetterti a MySQL così:

var cnx = new Connection();
cnx.connect(username, password, dbName, port, hostname).then((nothing) {
    // Do something with the connection
    cnx.query("show tables").then((Results results) {
        print("tables");
        for (List row in results) {
            print(row);
        }
    });
});