Skip to main content

tinybase_client 0.4.4 copy "tinybase_client: ^0.4.4" to clipboard
tinybase_client: ^0.4.4 copied to clipboard

Flutter SDK for the TinyBase backend: auth, JWT refresh, collection CRUD, file uploads, and realtime SSE.

tinybase_client #

Client Flutter/Dart pour le backend TinyBase (auth, JWT, CRUD, fichiers, realtime).

Docs : Getting Started

Pas affilié à la bibliothèque JavaScript TinyBase.

Install #

flutter pub add tinybase_client

Usage #

import 'package:tinybase_client/tinybase_client.dart';

final client = TinyBaseClient(baseUrl: 'https://your-api.example.com');

await client.auth.login(email: 'a@b.c', password: 'secret');
await client.auth.restore(); // au démarrage de l'app
// await client.auth.register(email: '...', password: '...', fields: {'display_name': 'Ada'});
// await client.auth.updateMe({'display_name': 'Ada Lovelace'});

final notes = client.collection('notes');
final page = await notes.list();
await notes.create({'title': 'Hello'});

// Fichier (champ FieldType.file)
await notes.create(
  {'title': 'Avec pièce jointe'},
  files: {
    'attachment': FileUpload(filename: 'doc.pdf', bytes: pdfBytes),
  },
);
final url = notes.fileUrl(recordId, 'attachment');

// Realtime
final sub = notes.subscribe().listen((change) {
  print('${change.action} ${change.recordId}');
});
// sub.cancel() pour fermer le SSE

Features #

  • Auth email/password
  • OAuth Discord / Microsoft (browser) et Google / Apple (idToken natif)
  • Refresh JWT automatique après un 401
  • CRUD /api/collections/<name>/records
  • Upload multipart pour les champs file
  • Realtime SSE (subscribe)
  • Persistance tokens via SharedPreferences (ou InMemoryTokenStore pour les tests)

Backend #

Ce package parle à une instance tinybase_server.
En prod (Railway), pointe DB_PATH vers un volume persisté (FILES_DIR suit le même dossier par défaut).

License #

MIT

1
likes
160
points
877
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Flutter SDK for the TinyBase backend: auth, JWT refresh, collection CRUD, file uploads, and realtime SSE.

Repository (GitHub)
View/report issues

Topics

#flutter #backend #authentication #rest #jwt

License

MIT (license)

Dependencies

flutter, flutter_secure_storage, http, http_parser, shared_preferences

More

Packages that depend on tinybase_client