Instance member ‘log’ can’t be accessed using static access

Issue

I have the following function and try to read the input values emailand password, but I get the following error:

  Future<void> _authenticate(
      String email, String password, String urlSegment) async {

    Console.log(email);
    Console.log(password);

    final url  Uri.parse('http://10.0.2.2:8000/api/$urlSegment');
    try {
      final response  await http.post(
        url,
        body: json.encode(
          {
            'email': email,
            'password': password,

            //'returnSecureToken': true,
          },
        ),
      );
.
.
.

Instance member ‘log’ can’t be accessed using static access.

What is the problem? Why I can’t use Console.log() in some points of application to see the value of the variables?

Solution

In flutter, we use the print statements to console in the debug.

Like this

 print(email);
    print(password);

You can also use debugPrint(“email”: $email) for the text that has more characters.

Answered By – Shahryar Rafique

Leave a Comment