mysql1_dart
mysql1_dart copied to clipboard
Invalid value: Not in inclusive range 0..5
//db connection function(mysql version 8) Future<MySqlConnection> createConnection() async { print("createConnection......"); final conn = await MySqlConnection.connect(ConnectionSettings( host: 'localhost', port: 3306, user: 'root', password: 'admin', db: 'my_test_db' )); print("createConnection......"); print(conn); return conn; }
Future<Results> getUserDetails(req, dbcon, userId) async { var dbcon = await ref.read(connPoolProvider).createConnection(); print("getStoreDetails"); var query ="SELECT * from store where user_Id= ? and is_active = 1 and is_delete = 0 ;";
var result = await dbcon.query(query,userId);
await dbcon.close();
return result;
}
Invalid value: Not in inclusive range 0..5
I have had the same issues with queries. I get, RangeError (RangeError (byteOffset): Invalid value: Not in inclusive range 0..5: 7)
I encountered the same issue.
And I found that if you put some delay between establishing the connection and making the query, everything is fine. So I ended up connecting the database on application launch, and making queries on requests.
Of course it's still an issue with this library. It fails to ensure an usable connection when it's returned. And delaying queries is a workaround only. I'm expecting a proper fix too.
I encountered the same issue.
And I found that if you put some delay between establishing the connection and making the query, everything is fine. So I ended up connecting the database on application launch, and making queries on requests.
Of course it's still an issue with this library. It fails to ensure an usable connection when it's returned. And delaying queries is a workaround only. I'm expecting a proper fix too.
Bless you... Added a delay and things started working