Into the circleAvatar from flutter before user put they own image I want to replace the space with the Initial value the first digit of the currentUser variable name into TextWidget. it means for example the Name is "john" I want to get "J" how we can reach that?
final imageUrl = true;
and build method
imageUrl ? CircleAvatar(
radius: 60,
backgroundImage: AssetImage(currentUser.imageUrl),)
: CircleAvatar(backgroundColor: Colors.yellow,
child: Text(currentUser.name[0]),),
SizedBox(
height: 60,
),
In this way I get it but I dont know how to if imageUrl is null return currentUser.name[0]