// Minimal, runnable-shaped example of wiring GarageAuth into a Flutter app. // Not a full app — just the moving parts. See the README for the callback // route + deep-link handling. import "package:flutter/material.dart"; import "package:garage_auth/garage_auth.dart"; final auth = GarageAuth( issuer: "https://hub.imbenji.net/auth-api", clientId: "my-app", redirectUri: "myapp://auth/callback", ); Future main() async { WidgetsFlutterBinding.ensureInitialized(); await auth.restore(); runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( home: ListenableBuilder( listenable: auth, builder: (context, _) { return Scaffold( appBar: AppBar(title: const Text("garage_auth example")), body: Center( child: auth.isSignedIn ? Column( mainAxisSize: MainAxisSize.min, children: [ const Text("Signed in 🎉"), TextButton( onPressed: () async { final me = await auth.profile(); debugPrint("profile: $me"); }, child: const Text("Print profile"), ), TextButton( onPressed: auth.signOut, child: const Text("Sign out"), ), ], ) : TextButton( onPressed: auth.signIn, child: const Text("Sign in with Garage"), ), ), ); }, ), ); } }