Save in variable and print in console user id of Firebase

Viewed 19

I want to save in a variable the user's uid brought from Firebase to later make a query with MySql but it gives me an error, I Want print in console the variable too, my code is as follows

Widget build(BuildContext context) {
return Scaffold(
    appBar: AppBar(title: Text('Bienvenido')),
    body: Container(
      child: Column(
        children: <Widget>[
          BlocBuilder<AuthCubit, AuthState>(

              buildWhen: (previous, current) => current is AuthSignedIn,
              builder: (_, state) {

                final authUser = (state as AuthSignedIn).user;
                return Center(
                  child: Column(
                    children: [

                      Text('Usuario: ${authUser.uid}'),

                      SizedBox(
                        height: 16,
                      ),
                      ElevatedButton(
                          onPressed: () => context.read<AuthCubit>().signOut(),
                          child: Text('Salir'))
                    ],

                  ),
                );
              }
          ),
          

        ],
      ),
    ),


);

The element type 'String' can't be assigned to the list type 'Widget'. is this line.

Text('Usuario: ${authUser.uid}'), usuario=authUser.uid; 
0 Answers
Related