Getting Started
This SDK leverages Rownd’s web and native iOS and Android SDKs to provide a simple interface for Flutter developers to add Rownd to their apps.Installation
Begin by depending onrownd_flutter_plugin and provider in your pubspec.yaml:
Platform-specific configuration
There are a couple of configuration settings that must be applied to the platform-specific code for your app in order for Rownd to work properly.Android
- 
Set your app’s targetSdkVersionto 32 or higher in your app’sbuild.gradlefile.
- 
Set your app’s minSdkVersionto 26 or higher in your app’sbuild.gradlefile. Rownd currently does not support an API version lower than 26.
- 
Ensure any Android activities (like MainActivity) subclassFlutterFragmentActivityinstead ofFlutterActivity. If you’re using the defaultMainActivitygenerated by Flutter, you can simply change the superclass toFlutterFragmentActivitylike this:
- Check and update your ProGuard config using the rules from our Android SDK.
Usage
Initialize the Rownd plugin and callrowndPlugin.configure(RowndConfig(appKey: 'YOUR_APP_KEY')); within your application wherever you do most of your app’s initialization.
Now you’re ready to use Rownd in your app. The plugin provides a RowndCubit class that can be used to manage the Rownd state.
A basic sign-in example might look like this:
home for the BlocProvider is determined by the RowndCubit’s authentication state. If the user is authenticated, the MyHomePage widget is displayed. If the user is not authenticated, the LoginPage widget is displayed.
There are many ways to define the UI based on the authentication state, but this is a simple and effective approach.
To learn more about Bloc and Cubit, see the flutter_bloc documentation.
RowndCubit
TheRowndCubit class is a Cubit that manages the Rownd state. It provides a simple interface for checking the current user’s authentication status, signing in and out, and getting the current user’s profile.
API
signIn(RowndSignInOptions? options)
Signs the user in. The options parameter is optional and can be used to specify additional options for the sign-in process.
RowndSignInOptions
| Property | Type | Description | 
|---|---|---|
| postSignInRedirect(not recommended) | String | If you’ve followed the steps to enable Android App Links, the redirect will be handled automatically. When the user completes the authentication challenge via email or SMS, they’ll be redirected to the URL set for postSignInRedirect. If this is an Android App Link, it will redirect the user back to your app. | 
| intent | String | This option applies only when you have opted to split the sign-up/sign-in flow via the Rownd dashboard. Valid values are .SignInor.SignUp. If you don’t set this value, the user will be presented with the unified sign-in/sign-up flow. Please reach out to support@rownd.io to enable. | 
signOut()
Signs the user out.
isAuthenticated()
Returns a boolean indicating whether the user is authenticated.
manageAccount()
Displays the current user’s profile information, allowing them to update it.
registerPasskey()
Registers a passkey for the user. A user must have successfully authenticated at least once before they can register a passkey.
user
Returns the current user’s profile as a Map<String, dynamic>.