パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v4.0.0

unsplash_client

Unsplashは無料の高解像度写真を提供しています。これはそのREST API用のクライアントです。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
3790
いいね数
67
Pub ポイント
160

パッケージをインストール

flutter pub add unsplash_client

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

unsplash_client パッケージは、Unsplash REST API のための Dart クライアントであり、Flutter アプリケーション内で高解像度で無料で使用可能な写真を直接取得できるようにします。このパッケージは、写真、ユーザー、コレクションの検索・取得・管理に使用するエンドポイントへの構造化アクセスを提供することで、Unsplash の画像ライブラリとの統合を簡素化します。モバイル、Web、デスクトップを含むすべての主要プラットフォームをサポートしており、動的で視覚的に豊かなコンテンツを必要とするアプリに最適です。明確で直感的な API を備えているため、Unsplash のデータと作業する際のボイラープレートコードを削減できます。

用途

  • ランダムまたは検索された画像を取得する
  • キュレートされた写真コレクションの表示
  • アプリに無料のストック写真を統合する
  • ビジュアルコンテンツ発見機能の構築
  • 高品質な画像によるアプリUIの向上

主な機能

  • シンプルな REST API ラッパー
  • すべてのプラットフォーム(Android、iOS、Web、macOS、Windows、Linux)をサポートしています
  • 写真、ユーザー、コレクション用の組み込みモデル
  • 簡単な検索とページネーション
  • 型安全な応答
  • 積極的なメンテナンスとオープンソース

適している対象

  • 無料のストック画像が必要なアプリ
  • デザイン重視またはビジュアルコンテンツプラットフォーム
  • 写真ギャラリーまたはインスピレーションアプリ
  • Flutter を使用したクロスプラットフォームプロジェクト
  • 信頼できる画像ソースを探している開発者

注意事項

  • Unsplash の API キーが必要です
  • APIキーごとにレート制限が適用されます
  • Unsplashの画像ライブラリに限定
  • ネットワーク接続に依存します
  • オフライン使用のためにキャッシュが必要になる場合があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

pub.dev package page GitHub Actions CI GitHub Stars

Unsplash provides free high-resolution photos. This is a client for their REST API.


If you're looking for a database solution, check out cbl, another project of mine. It brings Couchbase Lite to standalone Dart and Flutter, with support for:

  • Full-Text Search,
  • Expressive Queries,
  • Data Sync,
  • Change Notifications

and more.


Limitations

Endpoints that act on behalf of a user are not implemented, yet.If that is something you need, please comment on this issue.

Requirements

You need to register as a developer and create an Unsplash app to access the API.

Getting started

Create an UnsplashClient

Use the credentials for your app, obtained from the developer portal, to create an UnsplashClient:

final client = UnsplashClient(
  settings: ClientSettings(credentials: AppCredentials(
    accessKey: '...',
    secretKey: '...',
  )),
);

:warning: When you are done using a client instance, make sure to call it's close method.

Get a random photo

// Call `goAndGet` to execute the [Request] returned from `random`
// and throw an exception if the [Response] is not ok.
final photos = await client.photos.random(count: 1).goAndGet();

// The api returns a `Photo` which contains metadata about the photo and urls to download it.
final photo = photos.first;

Photo variants

A Photo comes with a set of urls for variants of the photo of different sizes, such as regular and thumb:

final thumb = photo.urls.thumb;

If the provided variants are not a good fit for your use, you can generate urls where you specify size, quality, fit and other parameters.

Call the extension method Uri.resizePhoto on photo.urls.raw to generate an Uri for a custom variant:

final custom = photo.urls.raw.resizePhoto(width: 400, height: 400);

Example

The example is a simple CLI app that fetches a few random photos.


Gabriel Terwesten • GitHub @blaugold • Twitter @GTerwesten • Medium @gabriel.terwesten

カテゴリー

依存関係

依存関係一覧 4 件

ソースリポジトリ

このパッケージを使用しているプロジェクト