A Dart Client for the Unsplash API.
This is a SuperDeclarative! project, not an official Unsplash package
If you get value from this package, please consider supporting SuperDeclarative!
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');Search photos:
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 testor
$ flutter testSupport for 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 /example directory.
- HTTP Basic Authentication
- User Authentication Flow
- Dynamic Client Registration
- GET /me
- PUT /me
- GET /users/:username
- GET /users/:username/portfolio
- GET /users/:username/photos
- GET /users/:username/likes
- GET /users/:username/collections
- GET /users/:username/statistics
- GET /photos
- GET /photos/:id
- GET /photos/random
- GET /photos/:id/statistics
- GET /photos/:id/download
- PUT /photos/:id
- POST /photos/:id/like
- DELETE /photos/:id/like
- GET /search/photos
- GET /search/collections
- GET /search/users
- GET /collections
- GET /collections/featured
- GET /collections/:id
- GET /collections/:id/photos
- GET /collections/:id/related
- POST /collections
- PUT /collections/:id
- DELETE /collections/:id
- POST /collections/:collection_id/add
- DELETE /collections/:collection_id/remove
- GET /stats/total
- GET /stats/month