uploadcare_client 0.0.1 copy "uploadcare_client: ^0.0.1" to clipboard
uploadcare_client: ^0.0.1 copied to clipboard

outdated

Flutter Uploadcare service client

Flutter Uploadcare Client #

Introduction #

Uploadcare is a complete file handling platform that helps you ship products faster and focus on your business goals, not files. With Uploadcare, you can build an infrastructure, optimize content, conversions, load times, traffic, and user experience. Read more...

Implemented features:

  • athorization
  • upload, read more
    • base
    • multipart
    • from url
    • signed uploads, read more
  • files API, read more
    • get one file
    • get list of files
    • remove multiple files
    • store multiple files
  • groups API
    • get one group
    • get list of groups
    • create group
    • store all files in group
  • video encoding, read more
    • create processing tasks
    • retrieve processing status
  • CDN API
  • Flutter (mobile/web)
    • UploadcareImageProvider

Roadmap:

  • document conversion
  • complete transformations API (overlays, gif to video, .etc)
  • write more tests
  • more informative example
  • test on web
  • improve documentation

Example: #

How to use library:

// create client with simple auth scheme
final client = UploadcareClient.withSimpleAuth(
  publicKey: DotEnv().env['UPLOADCARE_PUBLIC_KEY'],
  privateKey: DotEnv().env['UPLOADCARE_PRIVATE_KEY'],
  apiVersion: 'v0.5',
);
// or create client with reqular auth scheme
final client = UploadcareClient.withRegularAuth(
  publicKey: DotEnv().env['UPLOADCARE_PUBLIC_KEY'],
  privateKey: DotEnv().env['UPLOADCARE_PRIVATE_KEY'],
  apiVersion: 'v0.5',
);
// or more flexible
final client = UploadcareClient(
  options: ClientOptions(
    authorizationScheme: AuthSchemeRegular(
      apiVersion: 'v0.5',
      publicKey: env['UPLOADCARE_PUBLIC_KEY'],
      privateKey: env['UPLOADCARE_PRIVATE_KEY'],
    ),
    // rest options...
  ),
);

UploadcareClient has at the moment 4 API section

final ApiUpload upload;
final ApiFiles files;
final ApiVideoEncoding videoEncoding;
final ApiGroups groups;

You can use each api section separately, for example:

final options = ClientOptions(
  authorizationScheme: AuthSchemeRegular(
    apiVersion: 'v0.5',
    publicKey: env['UPLOADCARE_PUBLIC_KEY'],
    privateKey: env['UPLOADCARE_PRIVATE_KEY'],
  )
);

final upload = ApiUpload(options: options);
final fileId = await upload.base(File('...some/file'));
// ...etc.

The library provides UploadcareImageProvider for more effective use in the widget ecosystem, how to use image provider:

Image(
  image: UploadcareImageProvider(
    'uploadcare-image-file-uuid',
    // optional, apply transformations to the image
    transformations: [
      BlurTransformation(50),
      GrayscaleTransformation(),
      InvertTransformation(),
      ImageResizeTransformation(Size.square(58))
    ],
    // rest image props...
  ),
)

For more details see an example and read the doc on pub.dev #