There is a library for exactly this usage profile_name_avatar.
Supports network and local image with caching and has placeholder and name as fallback.
import 'package:profile_name_avatar/profile_name_avatar.dart';
ProfileImage(
imageSource: "https://example.com/avatar.jpg",
placeholder: "assets/images/placeholder.png", // Fallback when imagesource fail
fallbackName: "J D", // Used when both above fail
radius: 100, // Optional
textStyle: TextStyle( // Optional
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white,
),
backgroundColor: Colors.orange, // Optional
)
Fallback example
enter image description here