NetLens for http
Connects NetLens, the in-app HTTP inspector for Flutter, to http.
Install
dependencies:
netlens: ^1.2.0
netlens_http: ^1.2.0
Use
import 'package:http/http.dart' as http;
import 'package:netlens/netlens.dart';
import 'package:netlens_http/netlens_http.dart';
final netLens = NetLens();
final adapter = NetLensHttpAdapter();
netLens.addAdapter(adapter);
http
.get(Uri.parse('https://api.example.com/users'))
.interceptWithNetLens(adapter);
Mocks
NetLensHttpMockClient answers requests with mocks recorded by NetLens, so the
app can run offline:
final client = NetLensHttpMockClient(resolver: netLens.mocks);
netLens.mocks.mode = NetLensMockMode.replay;
await client.get(url).interceptWithNetLens(adapter);
See Mocks.
Documentation
You can find the documentation here.
Credits
NetLens is a fork of Alice by Jakub Homlala and its contributors, licensed under the Apache License 2.0.
Libraries
- netlens_http
- Connects NetLens to the http package.
- netlens_http_adapter
- netlens_http_extensions
- netlens_http_mock_client