A simple Flutter password-less authenticator using Magic Link
Add Magic_sdk to your pubspec.yaml
dependencies:
flutter:
sdk: flutter
magic_sdk: ^0.5.0
import 'package:magic_sdk/magic_sdk.dart';
Head over to Magic Link to save your public key API. We will call this "TOKEN"
void main() {
Magic.instance = Magic('YOUR API TOKEN');
}
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.
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Stack(children: [ // Use Stack() here
MaterialApp(
title: 'Magic Demo',
home: const LoginPage(),
),
Magic.instance.relayer // Insert Magic relayer here
]));
}
}