MockApiService

PHOTO EMBED

Sun Apr 13 2025 07:31:07 GMT+0000 (Coordinated Universal Time)

Saved by @manish23 #flutter

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()),
      ),
    ),
  );
}
content_copyCOPY