A Dart Client for the Unsplash API.
This is a SuperDeclarative! project, not an official Unsplash package
Unsplash is a service that provides access to royalty free stock photographs. In addition to direct browsing of photographs, Unsplash offers a developer API for accessing photos, collections of photos, users of the platform, and more.
This package is a client for the Unsplash API, built in the Dart language.
Unsplash API documentation: https://unsplash.com/documentation
Create a client:
final unsplashClient = UnsplashClient( accessKey: YOUR_API_KEY, );
Get a random photo:
final Photo photo = await unsplashClient.getRandomPhoto();
Get a specified photo:
final Photo photo = await unsplashClient.getPhoto(id: 'some_photo_id');
final PhotoSearchPage page = await unsplashClient.searchPhotos( query: 'some query or blank for featured photos', );
Load pages of photos:
final paginator = Paginator.listPhotos( client: unsplashClient, )..loadNextPage();
To run the tests in this package, define an environment variable called
UNSPLASH_KEY and set its value to your unsplash API key.
$ dart test
$ flutter test
flutter test will probably be removed as soon as the CI
system supports the Dart version. This is because a Dart package should
not depend upon Flutter's testing system.
An example project, built with Flutter, is available in the
API Version 1
xHTTP Basic Authentication