unsplash_client 0.1.0 unsplash_client: ^0.1.0 copied to clipboard
An unofficial client for the unsplash api.
An unofficial client for the unsplash api.
The client is platform independent, since it uses http to make requests.
This is a work in progress:
- ❌
Get the user’s profile
- ❌
Update the current user’s profile
- ✅
Get a user’s public profile
- ✅
Get a user’s portfolio link
- ✅
List a user’s photos
- ✅
List a user’s liked photos
- ✅
List a user’s collections
- ✅
Get a user’s statistics
- ✅
List photos
- ✅
Get a photo
- ✅
Get random photos
- ✅
Get a photo’s statistics
- ✅
Track a photo download
- ❌
Update a photo
- ❌
Like a photo
- ❌
Unlike a photo
- ✅
Search photos
- ✅
Search collections
- ✅
Search users
- ❌
List collections
- ❌
List featured collections
- ❌
Get a collection
- ❌
Get a collection’s photos
- ❌
List a collection’s related collections
- ❌
Create a new collection
- ❌
Update an existing collection
- ❌
Delete a collection
- ❌
Add a photo to a collection
- ❌
Remove a photo from a collection
- ✅
Stats.total
- ✅
Stats.month
Usage #
A simple usage example:
import 'package:unsplash_client/unsplash_client.dart';
void main() async {
// Create a client.
final client = UnsplashClient(
settings: Settings(
// Use the credentials from the developer portal.
credentials: AppCredentials(
accessKey: '...',
secretKey: '...',
)
),
);
// Fetch 5 random photos.
final response = await client.photos.random(count: 5).go();
// Check that the request was successful.
if (!response.isOk) {
throw 'Something is wrong: $response';
}
// Do something with the photos.
final photos = response.data;
// Create a dynamically resizing url.
final resizedUrl = photos.first.urls.raw.resize(
width: 400,
height: 400,
fit: ResizeFitMode.cover,
format: ImageFormat.webp,
);
}