arcane_framework library

The Arcane Framework is a comprehensive Dart package designed to provide a scalable architecture for managing essential application services such as logging, authentication, theming, feature flags, and more.

The framework offers a centralized way to access and manage these services, making it easy to build dynamic and feature-rich applications. It includes a robust logging system, dynamic feature toggles, theming capabilities, and user authentication handling.

Key Features:

  • Service Management: Centralized access to critical services like logging, feature flags, and theming.
  • Feature Flags: Dynamically enable or disable features using ArcaneFeatureFlagService.
  • Logging: Flexible logging with different severity levels (debug, info, error, etc.).
  • Theming: Easy light/dark mode switching with ArcaneThemeService.
  • Authentication: Manage user login, sign up, and token-based authentication.

Example usage:

import 'package:arcane_framework/arcane_framework.dart';

void main() {
  runApp(
    ArcaneApp(
      services: [MyArcaneService.I],
      child: MyApp(),
    ),
  );
}

This library is designed to simplify the development of complex, scalable Flutter applications by offering a set of tools to manage core functionalities efficiently.

Classes

Arcane
A singleton class that acts as the central hub for various services in the Arcane framework.
ArcaneApp
A root widget for an Arcane-powered application.
ArcaneAuthenticationService
Provides a standard interface to handle authentication-related tasks.
ArcaneAuthInterface
An abstract class that defines the authentication interface.
ArcaneEnvironment
An InheritedWidget that provides access to the application environment.
ArcaneEnvironmentProvider
A StatefulWidget that manages and provides the ArcaneEnvironment.
ArcaneEnvironmentService
A singleton service that stores and broadcasts the current application environment.
ArcaneFeatureFlagProvider
An InheritedWidget that provides access to enabled feature flags.
ArcaneFeatureFlagService
A singleton class that manages feature flags in the Arcane architecture.
ArcaneFeatureFlagsProvider
A StatefulWidget that keeps ArcaneFeatureFlagProvider in sync with ArcaneFeatureFlagService and rebuilds descendants when flags change.
ArcaneLogger
A singleton class that manages logging to one or more logging interfaces with optional metadata.
ArcaneService
An abstract class representing a service in the Arcane architecture.
ArcaneServiceLookup
Typed service lookup entrypoint for Arcane.service.
ArcaneServiceProvider
A provider that makes a list of ArcaneService instances available to the widget tree.
ArcaneTheme
ArcaneThemeService
A singleton service that manages theme switching and customization for the application.
ArcaneThemeSwitcher
CallbackLogInterceptor
A callback-backed implementation of LogInterceptor.
Environment
A value object representing the current application environment.
Error<T, E>
LogEvent
Immutable payload representing a single log entry.
LoggingInitializable
Optional lifecycle contract for logging interfaces that require setup.
LoggingInterceptorsService
LoggingInterface
Represents a logging interface that can log messages to different destinations.
LogInterceptor
A function-like object that intercepts and optionally transforms log events.
LogInterceptorContext
Provides contextual information for a LogInterceptor invocation.
Ok<T, E>
Result<T, E>
The Result Monad type which will encapsulate a success (ok) value of type T or a failure (error) value of type E

Enums

AuthenticationStatus
An enum representing the authentication status of a user.
Level
Enum representing the different logging levels used to control logging output.
SignUpStep
An enum representing the different steps in the sign-up process.

Mixins

ArcaneAuthAccountRegistration
Provides methods related to account registration and verification.
ArcaneAuthPasswordManagement
Provides methods for managing user passwords.
LoggerName
Opt-in mixin that exposes a name string on a LoggingInterface.
LoggingInitialization
Default initialization behavior for interfaces that opt into lifecycle.

Extensions

ArcaneFeatureFlagsContext on BuildContext
Convenience accessors for feature flags from BuildContext.
ArcaneThemeContext on BuildContext
DarkMode on BuildContext
An extension on BuildContext to check the current effective dark mode.
FeatureToggles on Enum
An extension on Enum to manage feature toggles.
FutureResultExtension on Future<Result<T, E>>
Extension methods on Future<Result> objects to provide the same operations that exist on the Result object for async method chaining
ServiceProviderExtension on BuildContext
An extension on BuildContext to provide easy access to ArcaneService instances that are registered in an ArcaneServiceProvider.

Functions

runCatching<T>(Result<T, dynamic> function()) Result<T, dynamic>
Allows library users to wrap potential exception throwing code in a way that transforms thrown exception objects into a failure monad. Runs the passed in function catching any thrown error objects and returning it as a result monad.
runCatchingAsync<T>(FutureResult<T, dynamic> function()) FutureResult<T, dynamic>
Runs the passed in async function catching any thrown error objects and returning it as a result monad.

Typedefs

ArcaneFeatureFlags = ArcaneFeatureFlagService
ArcaneFeatureFlagsScope = ArcaneFeatureFlagProvider
ArcaneReactiveTheme = ArcaneThemeService
FutureResult<T, E> = Future<Result<T, E>>
A shorthand type notation for Result futures FutureResult<int,String> func() async {}
LogInterceptorCallback = LogEvent? Function(LogEvent event, LogInterceptorContext context)
Signature for callbacks used by LogInterceptor.

Exceptions / Errors

ResultMonadException
Exception type for Result Monad specific exceptions (such as getting the success value when the Result contained is a failure.