transloadit 0.1.2
transloadit: ^0.1.2 copied to clipboard

A Flutter library that provides tooling to interact with the Transloadit API.

Dart

Transloadit Flutter SDK #

Flutter integration with Transloadit

Demo App #

image

Basic Examples #

Creating client #

TransloaditClient client = TransloaditClient(
        authKey: 'KEY',
        authSecret: 'SECRET');

Getting an assembly #

TransloaditResponse response = await client.getAssembly(
        assemblyID: 'ASSEMBLY_ID');
print(response.statusCode) // 200

Creating an assembly #

TransloaditAssembly assembly = client.newAssembly();

assembly.addStep("import", "/http/import",
        {"url": "https://demos.transloadit.com/inputs/chameleon.jpg"});
assembly.addStep("resize", "/image/resize", {"height": 400});

TransloaditResponse response = await assembly.createAssembly();

print(response['ok']) // "ASSEMBLY_COMPLETED"

Creating a template #

TransloaditTemplate template = client.newTemplate(name: "template");

template.addStep("import", "/http/import",
          {"url": "https://demos.transloadit.com/inputs/chameleon.jpg"});
template.addStep("resize", "/image/resize", {"use": "import", "height": 400});

TransloaditResponse response = await template.createTemplate();

print(response['ok']) // "TEMPLATE_CREATED"

Updating a template #

TransloaditResponse response = await client.updateTemplate(
        templateID: 'TEMPLATE_ID',
        template: {
          "import": {
            "robot": "/http/import",
            "url": "https://demos.transloadit.com/inputs/chameleon.jpg"
          },
          "resize": {"use": "import", "robot": "/image/resize", "height": 200}
        },
      );

print(response['ok']) // "TEMPLATE_UPDATED"

Running template with fields #

TransloaditAssembly assembly = client.runTemplate(
        templateID: 'TEMPLATE_ID', 
        params: {'fields': {'input': 'items.jpg'}});
TransloaditResponse response = await assembly.createAssembly();

print(response.data["ok"]); // "ASSEMBLY_COMPLETED"

Tracking upload progress #

TransloaditResponse response = await assembly.createAssembly(
        onProgress: (progressValue) {
          print(progressValue); // Value from 0-100
        },
        onComplete: () {
          // Do stuff
        }),
      );
1
likes
130
pub points
12%
popularity

A Flutter library that provides tooling to interact with the Transloadit API.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD (LICENSE)

Dependencies

cross_file, crypto, flutter, http, intl, nock, path, tus_client, universal_io

More

Packages that depend on transloadit