Preview:
class MockApiService implements ApiService {
  @override
  Future<String> fetchUserName() async {
    return "Mock User"; // Fake data, no delay
  }
}

void main() {
  // For testing, inject the mock
  runApp(
    MaterialApp(
      home: Scaffold(
        body: UserWidget(apiService: MockApiService()),
      ),
    ),
  );
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter