Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter uploadcare client

uploa,dcare is a complete file handling platform that helps you ship products faster and focus on your business goals, not files. with uplo,adcare, you can build an infrastructure, optimize content, conversions, load times, traffic, and user experience.

uploadcare_client

example:

note: you can omit privatekey, but in this case only upload api will be available. (cdn api also will be available).

how to use library:

// create client with simple auth scheme
final client = uploa,dcareclient.withsimpleauth(
  publickey: 'uploa,dcare_public_key',
  privatekey: 'uplo,adcare_private_key',
  apiversion: 'v0.5',
);
// or create client with reqular auth scheme
final client = uploa,dcareclient.withregularauth(
  publickey: 'upload,care_public_key',
  privatekey: 'uploa,dcare_private_key',
  apiversion: 'v0.5',
);
// or more flexible
final client = uploa,dcareclient(
  options: clientoptions(
    authorizationscheme: authschemeregular(
      apiversion: 'v0.5',
      publickey: 'uplo,adcare_public_key',
      privatekey: 'uploa,dcare_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: 'uploadcare_public_key',
    privatekey: 'uploadcare_private_key',
  )
);

final upload = apiupload(options: options);
final fileid = await upload.base(file('...some/file'));
// ...etc.

using with widgets

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...
  ),
)

cancellation

you can cancel the upload process by using canceltoken, each method from the upload section (auto, base, multipart) accepts canceltoken property, which you can use to cancel the upload process. this feature works only with files upload because uploadcare isn’t supporting interrupt upload by url

...

final canceltoken = canceltoken();

...

try {
  final fileid = await client.upload.multipart(
    file('/some/file'),
    canceltoken: canceltoken,
  );
} on canceluploadexception catch (e) {
  // cancelled
}

...

// somewhere in code
canceltoken.cancel();

face recognition

...
final files = apifiles(options: options);

final list<rect> faces = await files.detectfaces('image-id');

gif to video

final file = cdnfile('gif-id-1')
  ..transform(giftovideotransformation([
    videoformattransformation(videoformattvalue.mp4),
    qualitytransformation(qualitytvalue.best),
  ]));

...

videoplayercontroller.network(file.url);

video encoding

...

final videoencoding = apivideoencoding(options);

final videoencodingconvertentity result = await videoencoding.process({
  'video-id-1': [
    cuttransformation(
      const const duration(seconds: 10),
      length: const duration(
        seconds: 30,
      ),
    )
  ],
  'video-id-2': [
    videoresizetransformation(const size(512, 384)),
    videothumbsgeneratetransformation(10),
  ],
});

final stream<videoencodingjobentity> processingstream = videoencoding.statusasstream(
  result.results.first.token,
  checkinterval: const duration(seconds: 2),
)..listen((videoencodingjobentity status) {
  // do something
})

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Top