Skip to main content

nhost_dart 2.3.0 copy "nhost_dart: ^2.3.0" to clipboard
nhost_dart: ^2.3.0 copied to clipboard

Dart client for Nhost Auth, Storage, Functions, and GraphQL helpers for apps using Nhost.

Nhost Dart SDK #

Pub nhost_dart tests

Nhost authentication and file storage API clients for Dart and Flutter.

Includes support for:

  • User sign in and registration, including multi-factor authentication
  • Email and password changes, either directly or via email confirmation
  • Storage and retrieval of arbitrary files
  • Scaling and transformation of stored files
  • GraphQL authentication, via nhost_graphql_adapter

Sample #

import 'dart:typed_data';
import 'package:nhost_dart/nhost_dart.dart';
import 'package:nhost_storage_dart/nhost_storage_dart.dart' show FileData;

void main() async {
  final nhost = NhostClient(
    subdomain: Subdomain(
      region: 'eu-central-1',
      subdomain: 'backend-5e69d1d7',
    ),
  );

  // For self-hosted or local projects, use ServiceUrls instead.
  /*
  final nhost = NhostClient(
    serviceUrls: ServiceUrls(
      authUrl: 'http://localhost:1337/v1/auth',
      storageUrl: 'http://localhost:1337/v1/storage',
      functionsUrl: 'http://localhost:1337/v1/functions',
      graphqlUrl: 'http://localhost:1337/v1/graphql',
    ),
  );
  */

  // User registration
  final authResponse = await nhost.auth.signUp(
    email: 'new-user@gmail.com',
    password: 'password-1',
  );

  // Upload a file
  final currentUser = authResponse.user ?? nhost.auth.currentUser;
  await nhost.storage.uploadBytes(
    fileName: '/users/${currentUser!.id}/image.jpg',
    fileContents: [/* ... */],
    mimeType: 'image/jpeg',
  );

  // Log out
  await nhost.auth.signOut();

  // Release resources
  nhost.close();
}

Getting Started #

Latest Release #

dependencies:
  nhost_dart: ^2.2.0

🔥 More Dart & Flutter packages from Nhost #

12
likes
150
points
459
downloads

Documentation

API reference

Publisher

verified publishernhost.io

Weekly Downloads

Dart client for Nhost Auth, Storage, Functions, and GraphQL helpers for apps using Nhost.

License

MIT (license)

Dependencies

http, http_parser, logging, meta, nhost_auth_dart, nhost_functions_dart, nhost_graphql_adapter, nhost_sdk, nhost_storage_dart, path

More

Packages that depend on nhost_dart