flutter logger code example

Example 1: how to log data to the flutter console ?

import 'package:flutter/foundation.dart';

debugPrint('movieTitle: $movieTitle');

Example 2: 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 3: After logging in flutter

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

Tags:

Css Example