This package is a wrapper written in the Dart programming language for Wallhaven API calls.
WallhavenApiClient can provide wrappers for the endpoints listed under Wallhaven API documentation.
To use package include wallhaven_api in your pubspec.yaml file.
dependencies:
wallhaven_api: ^0.1.0
Initialize API Client:
WallhavenApiClient api = WallhavenApiClient();
Get wallpaper by ID:
try {
Wallpaper wallpaper = await api.wallpaper('id');
print(wallpaper.data.path);
} catch (e) {
if (e is WallhavenException) {
print(e.error);
}
}
Please follow the guideline from the official API documentation.
Here is a list of known limitations that will be resolved in the future:
- No possibility for including a header to the request.
- Missing query params for a search endpoint.
- No error codes.
Feel free to create a new issue if you found any problem with the package.
Create a discussion in case you think some features are missing.