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
ArcaneFeatureFlags
. - Logging: Flexible logging with different severity levels
(
debug
,info
,error
, etc.). - Theming: Easy light/dark mode switching with
ArcaneReactiveTheme
. - 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
-
A
Cubit
that manages the application environment state. - ArcaneEnvironmentProvider
-
A widget that provides
ArcaneEnvironment
to the widget tree usingBlocProvider
. - ArcaneFeatureFlags
- A singleton class that manages feature flags in the Arcane architecture.
- ArcaneLogger
- A singleton class that manages logging to one or more logging interfaces with optional metadata.
- ArcaneReactiveTheme
- A singleton service that manages theme switching and customization for the application.
- ArcaneService
- An abstract class representing a service in the Arcane architecture.
- ArcaneServiceProvider
-
A provider that makes a list of
ArcaneService
instances available to the widget tree. - LoggingInterface
- Represents a logging interface that can log messages to different destinations.
-
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.
- Environment
- An enum representing the different application environments.
- 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.
Extensions
- DarkMode on BuildContext
-
An extension on
BuildContext
to check the current system dark mode setting. - FeatureToggles on Enum
-
An extension on
Enum
to manage feature toggles. -
FutureResultExtension
on Future<
Result< T, E> > - Extension methods on Future
- ServiceProvider on BuildContext
-
An extension on
BuildContext
to provide easy access toArcaneService
instances that are registered in anArcaneServiceProvider
.
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
-
FutureResult<
T, E> = Future< Result< T, E> > -
A shorthand type notation for Result futures
FutureResult<int,String> func() async {}
Exceptions / Errors
- ResultMonadException
- Exception type for Result Monad specific exceptions (such as getting the success value when the Result contained is a failure.