dio_image_provider 0.0.2 dio_image_provider: ^0.0.2 copied to clipboard
An image provider which makes use of package:dio to instead of dart:io
DIO image provider #
This is an alternative to Image.network()
which makes use of the dio
package.
Motivation #
By re-using dio as network client for images over the network, you can easily re-use existing authentication code. This also makes it easier to do performance monitoring when used with Sentry, Datadog or similar.
Usage #
Image(
image: DioImage(Uri.parse('https://http.cat/200')),
)
Optionally, you can supply your own Dio
client.
// Either by setting it globally
DioImage.defaultDio = Dio();
// or by supplying it via constructor
Image(
image: DioImage(
Uri.parse('https://http.cat/200'),
dio: Dio(),
),
)
If you use http
instead of dio, try http_image_provider