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

Flutter SDK for Fluo, an elegant and easy to set up user onboarding flow.

Fluo #

Installation #

Add the package to your dependencies:

flutter pub add fluo

Add the FluoLocalizations.delegate to your App:

import 'package:fluo/l10n/fluo_localizations.dart';

MaterialApp(
  localizationsDelegates: const [
    AppLocalizations.delegate,
    GlobalMaterialLocalizations.delegate,
    GlobalWidgetsLocalizations.delegate,
    GlobalCupertinoLocalizations.delegate,
    FluoLocalizations.delegate, // Add this line
  ],
  // ...
)

Usage #

import 'package:fluo/fluo.dart';

// Initialize fluo.
final fluo = await Fluo.init('your-api-key');

// Get the stored access token to determine if you should present
// the connect flow to the user.
String? accessToken = await fluo.getAccessToken();
if (accessToken == null) {
  // There is no valid token, show the connect flow.
  fluo.showConnectFlow(
    context: context,
    onUserReady: () {
      // You're good to go. By the way, you should never store the
      // access token, but always retrieve it using the `getAccessToken`
      // method because it takes care of refreshing it if it has expired.
      // This is why this method is async.
      accessToken = await fluo.getAccessToken();
    },
  );
} else {
  // You're good to go. You can use the access token to communicate
  // with your backend.
}