Home > Mobile >  How to create a widget for map function in flutter with buildContext
How to create a widget for map function in flutter with buildContext

Time:08-16

I have this code

final users = snapshot.data!;
              return ListView(
                children: users.map(buildMember).toList(),
              );

I want to create a widget with buildConext

I tried

Widget buildMember(Member user, BuildContext context) => Card(
        child: ListTile()
);

But got this error: enter image description here

CodePudding user response:

users.map((user) => buildMember(user, context)).toList(),
  • Related