dummy_api_overlay library
A Flutter package that provides a developer overlay to mock REST API responses during development — without touching your real networking code.
Quick start
- Wrap your app:
void main() {
runApp(DummyApiOverlay(child: MyApp()));
}
- Use DummyHttpClient instead of
http.Client:
final client = DummyHttpClient();
final res = await client.get(Uri.parse('https://api.example.com/users'));
- Or add DummyDioInterceptor to your Dio instance:
dio.interceptors.add(DummyDioInterceptor());
- Tap the floating API button in your app to manage mock rules.
Classes
- DummyApiOverlay
- Wraps your app's widget tree and injects a draggable overlay button that opens the mock rules manager screen.
- DummyDioInterceptor
-
A
Interceptorfor Dio that intercepts requests matching any enabled MockRule and resolves with the configured dummy response. - DummyHttpClient
-
A drop-in replacement for
http.Clientthat intercepts requests matching any enabled MockRule and returns the configured dummy response. - MockRule
- MockRuleStore