Skip to main content

strivacity_pushnotification 1.0.0-rc1 copy "strivacity_pushnotification: ^1.0.0-rc1" to clipboard
strivacity_pushnotification: ^1.0.0-rc1 copied to clipboard

Push-based multi-factor authentication for Flutter apps on Android and iOS: enroll a device, receive sign-in challenges, and approve, deny or answer them.

example/lib/main.dart

/// Push Notification Example app
///
/// Quick start for example app:
///   - `main` runs [PushExampleApp], which starts the services the application
///     needs and then opens its first screen. Some config options are available
///     in `config.dart`.
///   - Push related functionality, such as enrolling devices and resolving
///     challenges, is in the `usecases` folder. Every PushNotification SDK call
///     is made there.
///   - [ChallengeInbox] service collects challenges from Intents, FCM push
///     notification payloads, APNs callbacks channels. It serializes them and
///     indirectly instructs app to display them in LIFO order
///   - [DeviceTokenSource] for producing the Device Tokens for enrollments. It
///     also watches for FCM token rotations and starts enrollment update
///     mechanism when detected.
library;

import 'dart:async';

import 'package:flutter/material.dart';

import 'dependency.dart';
import 'routes.dart';
import 'theme/app_theme.dart';
import 'usecases/push/challenge_inbox.dart';
import 'usecases/push/device_token_source.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(PushExampleApp(dependencies: createAppDependencies()));
}

class PushExampleApp extends StatefulWidget {
  const PushExampleApp({required this.dependencies, super.key});

  final AppDependencies dependencies;

  @override
  State<PushExampleApp> createState() => _PushExampleAppState();
}

class _PushExampleAppState extends State<PushExampleApp> {
  @override
  void initState() {
    super.initState();
    // Starts the app's services and opens its first screen when they are up.
    unawaited(widget.dependencies.launch());
  }

  @override
  Widget build(BuildContext context) => MaterialApp(
    theme: AppTheme.data,
    navigatorKey: widget.dependencies.navigator.navigatorKey,
    routes: widget.dependencies.routes,
    // Always start at the splash, whatever route the platform launched the app with (`flutter run
    // --route`). Otherwise the splash, and with it bootstrapping, would be skipped.
    onGenerateInitialRoutes: (initialRoute) => [
      MaterialPageRoute<void>(
        settings: const RouteSettings(name: AppRoute.splash),
        builder: widget.dependencies.routes[AppRoute.splash]!,
      ),
    ],
  );
}
1
likes
160
points
690
downloads

Documentation

API reference

Publisher

verified publisherstrivacity.com

Weekly Downloads

Push-based multi-factor authentication for Flutter apps on Android and iOS: enroll a device, receive sign-in challenges, and approve, deny or answer them.

Homepage
Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

flutter, meta, plugin_platform_interface

More

Packages that depend on strivacity_pushnotification

Packages that implement strivacity_pushnotification