0

I am trying to build an app that contains chat, but the error message appears because this line:

 return FutureBuilder(
      future: FirebaseAuth.instance.currentUser,
The argument type 'User' can't be assigned to the parameter type 'Future<dynamic>'.

my code enter image description here

Manal
  • 169
  • 1
  • 3
  • 15

1 Answers1

2

currentUser is a property and it returns a value of type User therefore you don't have to assign it to the future property, just do:

User user = FirebaseAuth.instance.currentUser;
Peter Haddad
  • 78,874
  • 25
  • 140
  • 134