class HomePage extends StatelessWidget {
HomePage(
{super.key, required this.mailId, required this.name, required this.pic});
String mailId;
String name;
String pic = "data:image/webp;base64,UklGOOOyAR0vA6w6+gjEQiUr+bqpnJ/uGmjaRdZFh40GKjdvH1pau8C0saW81R0lAty9idmf0CrPXpzp6gr11ZILJOuAAAAAAAAAAAAAA==";
@override
Widget build(context) {
return Scaffold(
appBar: AppBar(
title: const Text("Home page"),
backgroundColor: Colors.amber,
actions: [
GestureDetector(
onTap: () {
Navigator.of(context).pop(
MaterialPageRoute(
builder: (context) =>
ProfilePage(pic,mailID: mailId, name: name, img: pic)),
);
//ProfilePage(mailID: mailId, name: name, img: pic);
},
child: const CircleAvatar(
radius: 30,
backgroundImage: NetworkImage(pic),
),
)
],
),
I tried to assign the string as const but it’s not allowing it, as you can see I assigned the image url to the String & tried to use it inside the network image, but returning an error. I tried even null check pointer still it showing me errors.NOTE: not an valid url in the snippet.
Your image URL is not in the correct format, use something like this for network image
String pic = "https://images.pexels.com/photos/18184356/pexels-photo-18184356/free-photo-of-south-american-coati-in-nature.jpeg";
have you check with another URL.? and what the error says ?