clerk_flutter 0.0.3-dev copy "clerk_flutter: ^0.0.3-dev" to clipboard
clerk_flutter: ^0.0.3-dev copied to clipboard

Package that will allow you to authenticate and use Clerk from Flutter code.


Clerk Flutter / Pre-release Alpha #

The official Clerk Flutter client library.

This package will allow you to authenticate your users and use Clerk services from your Flutter code.

Pub Version Pub Points chat on Discord documentation twitter

Requirements #

  • Flutter >= 3.24.0
  • Dart >= 3.5.0

Example Usage #

To use this package you will need to go to your Clerk Dashboard create an application and copy the public and publishable API keys into your project.

class MainApp extends StatefulWidget {
  const MainApp({
    super.key,
    required this.publicKey,
    required this.publishableKey,
  });

  final String publicKey;
  final String publishableKey;

  @override
  State<MainApp> createState() => _MainAppState();
}

class _MainAppState extends State<MainApp> {
  final persistor = const _Persistor();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: ClerkAuth(
        publicKey: widget.publicKey,
        publishableKey: widget.publishableKey,
        persistor: persistor,
        child: Scaffold(
          backgroundColor: ClerkColors.whiteSmoke,
          body: Padding(
            padding: horizontalPadding32,
            child: Center(
              child: ClerkAuthBuilder(
                signedInBuilder: (context, auth) => const ClerkUserButton(),
                signedOutBuilder: (context, auth) => const ClerkAuthenticationWidget(),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

License #

This SDK is licensed under the MIT license found in the LICENSE file.