2012-08-15 61 views

回答

12

您可以使用SQLJocky連接到MySQL。添加

dependencies: 
    sqljocky: 0.0.4 

pubspec.yaml的運行酒館安裝。現在,您可以連接到MySQL這樣

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); 
    } 
    }); 
});