패키지, 저장소 및 앱 카테고리 검색

패키지 상세v4.0.0

unsplash_client

Unsplash는 무료 고해상도 사진을 제공합니다. 이것은 그들의 REST API용 클라이언트입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
3.8천
좋아요
67
Pub 점수
160

패키지 설치

flutter pub add unsplash_client

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

unsplash_client 패키지는 Unsplash REST API용 Dart 클라이언트로, 개발자가 Flutter 애플리케이션에서 고해상도의 무료 사용 가능한 사진을 직접 가져올 수 있게 해줍니다. 이 패키지는 사진, 사용자 및 컬렉션에 대한 검색, 검색 및 관리를 위한 엔드포인트에 구조화된 접근을 제공함으로써 Unsplash 이미지 라이브러리와의 통합을 간소화합니다. 모바일, 웹, 데스크톱을 포함한 모든 주요 플랫폼을 지원하여 동적이고 시각적으로 풍부한 콘텐츠가 필요한 앱에 이상적입니다. 깔끔하고 직관적인 API를 통해 Unsplash 데이터 작업 시 반복 코드를 줄일 수 있습니다.

사용 사례

  • 랜덤 또는 검색된 이미지 가져오기
  • 선정된 사진 컬렉션 표시
  • 앱에 무료 주식 사진 통합하기
  • 시각 콘텐츠 탐색 기능 구축
  • 고품질 이미지로 앱 UI 향상

주요 기능

  • 간단한 REST API 래퍼
  • 모든 플랫폼(안드로이드, 아이폰, 웹, 맥OS, 윈도우, 리눅스)을 지원합니다
  • 사진, 사용자 및 컬렉션용 내장 모델
  • 간편한 검색 및 페이징
  • 타입 안전한 응답
  • 활성 유지보수 및 오픈소스

적합한 대상

  • 무료 주식 이미지가 필요한 앱
  • 디자인 중심 또는 시각 콘텐츠 플랫폼
  • 사진 갤러리 또는 영감 앱
  • 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 개

소스 저장소

이 패키지를 사용하는 프로젝트