Skip to content

Unable to solve error - SocketException: Socket has been closed #157

@FernandoLucasDev

Description

@FernandoLucasDev

I'm making a mySql connection with dard but I aways getting this error:

Unhandled exception:
SocketException: Socket has been closed

to this code below:

`import 'dart:async';
import 'package:mysql1/mysql1.dart';

class Connect {

Future conection() async {
final conn = await MySqlConnection.connect(ConnectionSettings(
host: '',
port: 3306,
user: '',
db: '',
password: '',
useCompression: false,
useSSL: false,
timeout: const Duration(seconds: 20)));

return conn;

}

}

Does someone knows how to fix it?

In this code I return conn because I use it in another class that finds my query, that I'm making in a dynamic way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions