flutter logger package code example

Example 1: logging in flutter

onPressed: () async {
                  setState(() {
                    sponner = true;
                  });
                  try {
                    final newUser = await _auth.signInWithEmailAndPassword(
                        email: email, password: password);
                    if (newUser != null) {
                      Navigator.pushNamed(context, ChatScreen.id);
                    }
                    sponner = false;
                  } catch (e) {
                    print(e);
                  }
                },

Example 2: After logging in flutter

void getCurrentUser() async {
    try {
      final user = await _auth.currentUser();
      if (user != null) {
        loggedUser = user;
      }
    } catch (e) {
      print(e);
    }
  }

Tags:

Misc Example