Back to Blog

Announcing Nhost SDK for Flutter

11 May 2021
Transparent lines
Banner of Announcing Nhost SDK for Flutter

Finally, it's easy for flutter developers to build full-stack apps. The Dart & Flutter SDK for Nhost makes it easy to handle authentication, storage and GraphQL in any Flutter application.

Nhost is a Firebase alternative built on open source software. With a Nhost project you get a Postgres database. On top of the database we automatically generate a GraphQL API based on your tables and columns in your database. Nhost also handles authentication and storage.

This enables developers to focus on their app and users, instead of building and managing infrastructure.

Our new Flutter SDK makes it easy for Flutter developers to build rich applications.


Our Flutter SDK integrates with graphql, currently the most popular GraphQL client for Dart, meaning users are automatically authenticated when sending GraphQL requests in the app.

Our Flutter SDK also connects to graphql_flutter to generate GraphQL widgets.

See full examples here.


Register and login your users in your Flutter application:

// Setupfinal client = NhostClient(baseUrl: nhostApiUrl);

// Login
await loginOrRegister(client, email: '', password: 'password-1');

// Print out a few details about the current userfinal currentUser = client.auth.currentUser;
print(' ${}');
print('currentUser.displayName: ${currentUser.displayName}');
print(' ${}');

// And logoutawait client.auth.logout();

See full auth examples here.


Let users upload and download files in your Flutter application:

final fileName = 'henry.jpg';
final userPath = '/user/${}/';
final filePath = '$userPath$fileName';

// Store a new image originalImageBytes = File('./assets/henry.jpg').readAsBytesSync();
final imageMetadata = await
filePath: filePath,
bytes: originalImageBytes,
contentType: 'image/jpeg',
print('Uploaded image');
print('Size: ${originalImageBytes.length}');

// ...turn around and download its contents, downloadedImage = await
fileToken: imageMetadata.nhostMetadata.token,
imageTransformConfig: ImageTransformConfig(width: 100, quality: 50),
print('Downloaded transformed image');
print('Size: ${downloadedImage.bodyBytes.length}');

// ...then delete it.await;

See full storage examples here and here.

Share this post

Twitter LogoLinkedIn LogoFacebook Logo