Initial release
This commit is contained in:
2024-09-11 12:49:35 -04:00
committed by GitHub
parent 092046544b
commit 56ebaeb346
24 changed files with 2454 additions and 0 deletions
+96
View File
@@ -0,0 +1,96 @@
import "package:arcane_framework/arcane_framework.dart";
/// A singleton class that acts as the central hub for various services in the
/// Arcane framework.
///
/// `Arcane` provides access to important services like logging, feature flags,
/// authentication, theming, secure storage, and ID management. It also offers a
/// convenient method for logging messages using the integrated logger.
class Arcane {
Arcane._internal();
/// Creates a singleton instance of `Arcane`.
///
/// This factory constructor always returns the same instance of `Arcane`.
factory Arcane() => Arcane._internal();
/// Provides access to the singleton instance of the logger service.
///
/// The `ArcaneLogger` is used for logging messages throughout the app.
static ArcaneLogger get logger => ArcaneLogger.I;
/// Provides access to the singleton instance of the feature flags service.
///
/// `ArcaneFeatureFlags` manages feature toggles, allowing you to enable or
/// disable features dynamically.
static ArcaneFeatureFlags get features => ArcaneFeatureFlags.I;
/// Provides access to the singleton instance of the authentication service.
///
/// `ArcaneAuthenticationService` manages user authentication, login, and
/// signup processes.
static ArcaneAuthenticationService get auth => ArcaneAuthenticationService.I;
/// Provides access to the singleton instance of the theme management service.
///
/// `ArcaneReactiveTheme` allows switching between light and dark themes and
/// customizing them.
static ArcaneReactiveTheme get theme => ArcaneReactiveTheme.I;
/// Provides access to the singleton instance of the secure storage service.
///
/// `ArcaneSecureStorage` is responsible for securely storing key-value pairs,
/// such as tokens or user data.
static ArcaneSecureStorage get storage => ArcaneSecureStorage.I;
/// Provides access to the singleton instance of the ID service.
///
/// `ArcaneIdService` manages unique identifiers for installations and sessions.
static ArcaneIdService get id => ArcaneIdService.I;
/// Returns a list of all services available in the Arcane framework.
///
/// This list includes the feature flags, authentication, theme, and ID services.
static List<ArcaneService> get services => [
features,
auth,
theme,
id,
];
/// Logs a message using the integrated logger.
///
/// This method is a convenient way to log messages with optional module,
/// method, log level, stack trace, and additional metadata. The default log
/// level is `Level.debug`.
///
/// Example:
/// ```dart
/// Arcane.log("This is a log message", module: "MyModule", method: "MyMethod");
/// ```
///
/// - [message]: The message to log.
/// - [module]: Optional name of the module from which the log originated.
/// - [method]: Optional name of the method from which the log originated.
/// - [level]: The log level (e.g., `Level.debug`, `Level.error`), defaults to
/// `Level.debug`.
/// - [stackTrace]: Optional stack trace information.
/// - [metadata]: Optional additional metadata in key-value pairs.
static void log(
String message, {
String? module,
String? method,
Level level = Level.debug,
StackTrace? stackTrace,
Map<String, String>? metadata,
}) {
ArcaneLogger.I.log(
message,
module: module,
method: method,
level: level,
stackTrace: stackTrace,
metadata: metadata,
);
}
}