It's time again to welcome a new SDK! This time around, it's for the powerful cross-platform development framework Flutter. From the launch of 0.2.0, every aspect of the Transloadit API is supported, including resumable file uploads using the Tus protocol. The SDK is still in beta, so it is not currently production ready. However, more users testing the SDK and looking for bugs, will help to make it more stable over time.

Check out the package on

Flutter logo


You can install the SDK into your Flutter project with a simple command:

flutter pub add transloadit

Or alternatively by including the package within your pubspec.yaml:

  transloadit: ^1.0.0

Afterwards, run flutter pub get, for the package (and all its dependencies) to automatically be installed into your project.

You can then import the SDK into a Dart file to access its methods and classes.

import 'package:transloadit/transloadit.dart';

Using the SDK

Our first step in interacting with the Transloadit API through Flutter is creating a client. The client contains our API key and secret, and we'll be creating Assemblies using it.

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

Every endpoint of the Transloadit API is abstracted through the client, removing the need for you to manually specify the HTTP requests.

Creating an Assembly

To create an Assembly, we first need to create the Assembly object. We'll assign files and Steps to the Assembly object which we'll later pass on to the API. We'll use the client's newAssembly method to do this.

TransloaditAssembly assembly = client.newAssembly();

We'll then attach a sample file to the Assembly object.

final imagePath = 'cat.jpg';
File cat = File(imagePath);
assembly.addFile(file: cat);

Let's also add a resize Step, so our image will be 400px wide.

assembly.addStep('resize', '/image/resize', {'width': 400});

Finally, we can use the Assembly object's createAssembly method to pass our Assembly Instructions and file onto the API to be processed.

We'll also be using onProgress and onComplete callbacks here. You can use these callbacks to track the progress of the Tus upload, and to provide some feedback to your users on their file uploads. I'm using the callbacks to trigger a state update whenever the upload progresses or completes.

TransloaditResponse response = await assembly.createAssembly(
        onProgress: (progressValue) => setState(() => progress = progressValue);
        onComplete: () => setState(() => uploadComplete = true),

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

What next?

To see a full example app made with this SDK, take a look at the Transloadit recipe app.

However, that's all for this blog. It's as easy as that to start using the Transloadit Flutter SDK. Feel free to get in contact with us on support if you run into any troubles. Also make sure to report bugs on the GitHub repo, and we'll fix them 🔧