A Flutter sample app that illustrates how to configure and use
package:http
.
-
Provide you with example code for using
package:http
in Flutter, including:- configuration for multiple platforms.
- using
package:provider
to passClient
s through an application. - writing tests using
MockClient
.
This library used to create package:http
Client
s when the app is run inside
the Dart virtual machine, meaning all platforms except the web browser.
This library used to create package:http
Client
s when the app is run inside
a web browser.
Web configuration must be done in a separate library because Dart code cannot
import dart:ffi
or dart:io
when run in a web browser.
This library demonstrates how to:
- import
http_client_factory.dart
orhttp_client_factory_web.dart
, depending on whether we are targeting the web browser or not. - share a
package:http
Client
by usingpackage:provider
. - call
package:http
Client
methods.
This library demonstrates how to construct tests using MockClient
.