Skip to main content

vaultbase_flutter 0.1.3 copy "vaultbase_flutter: ^0.1.3" to clipboard
vaultbase_flutter: ^0.1.3 copied to clipboard

Flutter helpers for the Vaultbase client. Secure token storage, OAuth sign-in and app lifecycle.

vaultbase_flutter #

The Vaultbase client for Flutter apps. It re-exports vaultbase and adds:

  • Sessions that survive restarts: SecureAuthStore (Keychain / Keystore) and PrefsAuthStore (shared preferences, for the web).
  • OAuth in the system browser: signInWithOAuth2, through ASWebAuthenticationSession on iOS and macOS and Custom Tabs on Android.
  • App lifecycle: VaultbaseLifecycle closes the realtime connection in the background, reconnects on resume, and refreshes a session close to expiry.
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:vaultbase_flutter/vaultbase_flutter.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final vb = Vaultbase('https://api.example.com',
      authStore: kIsWeb ? PrefsAuthStore() : SecureAuthStore());
  await vb.authStore.ready;
  VaultbaseLifecycle(vb);
  runApp(MyApp(vb: vb));
}

// Later, on a button:
final result = await vb.auth
    .collection('users')
    .signInWithOAuth2('github', redirectUri: 'com.example.app://oauth');

OAuth needs the redirect scheme registered on Android and the redirect allowed on the server: see Flutter set-up.

Needs Flutter 3.27 (Dart 3.6), iOS 13, and a Vaultbase server 0.27 or later. A complete app (sign-in, GitHub sign-in, a live list) is in the example.

Documentation #

docs.vaultbase.dev/sdk-dart/quick-start

0
likes
0
points
842
downloads

Documentation

Documentation

Publisher

verified publishervaultbase.dev

Weekly Downloads

Flutter helpers for the Vaultbase client. Secure token storage, OAuth sign-in and app lifecycle.

Homepage
Repository (GitHub)
View/report issues

Topics

#backend #database #realtime #authentication

License

unknown (license)

Dependencies

flutter, flutter_secure_storage, flutter_web_auth_2, shared_preferences, vaultbase

More

Packages that depend on vaultbase_flutter