bark 0.0.1 copy "bark: ^0.0.1" to clipboard
bark: ^0.0.1 copied to clipboard

Flutter Client for Bark Authentication

example/lib/main.dart

import 'package:bark/bark.dart';
import 'package:flutter/material.dart';
import 'package:logo/logo.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({
    super.key,
  });

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    final BarkAuthenticationSignIn signIn = BarkAuthenticationSignIn(
      authenticatorDomain: "bark.sh",
      targetDomain: "example.flutter.authentication.client.bark.sh",
      overrideAuthenticationModuleDomain: Uri.http("localhost:4000"),
      logLevel: LogoLogLevel.all(),
    );

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Bark Client Authentication Example'),
        ),
        body: Center(
          child: Builder(
            builder: (BuildContext context) {
              return ElevatedButton(
                child: const Text("Authenticate"),
                onPressed: () {
                  signIn.signIn().then((BarkSignInResult? result) {
                    if (result == null) {
                      return;
                    }

                    showDialog(
                      context: context,
                      builder: (BuildContext context) {
                        return AlertDialog(
                          title: const Text("Authentication Result"),
                          content: Text(result.toString()),
                          actions: [
                            TextButton(
                              child: const Text("OK"),
                              onPressed: () {
                                Navigator.of(context).pop();
                              },
                            ),
                          ],
                        );
                      },
                    );
                  });
                },
              );
            },
          ),
        ),
      ),
    );
  }
}
0
likes
0
points
75
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter Client for Bark Authentication

Homepage

License

unknown (license)

Dependencies

basic_utils, dio, flutter, flutter_web_auth_2, logo

More

Packages that depend on bark