Magic for Flutter

Magic for Flutter

New to Magic?

Create a fully-functional Magic auth demo in minutes.

Build a demo


The Magic Flutter SDK is distributed on the package manager. This is your entry-point to secure, passwordless authentication for your iOS or Android-based Flutter app. This guide will cover some important topics for getting started with client-side APIs and to make the most of Magic's features.

Magic can support either server-based or serverless applications. It is up to the developers to implement the Admin SDK to validate the DID Token.


Add magic_sdk to your pubspec.yaml:

    sdk: flutter
  magic_sdk: ^0.3.0

Run the following command to install dependencies

$ dart pub get

#Create an SDK Instance

In main.dart, instantiate Magic with your publishable key

void main() {
  runApp(const MyApp());

  Magic.instance = Magic("YOUR_PUBLISHABLE_KEY");

Use Stack in the top level and add Magic.instance.relayer to the children of Stack to ensure the best performance

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Stack(children: [ // Use Stack() here
            title: 'Magic Demo',
            home: const LoginPage(),
          Magic.instance.relayer // Insert Magic relayer here

Server-side SDKs?

Integrate Magic with your existing backend.

Did you find what you were looking for?

Did you find what you were looking for?