Alice constructor

Alice({
  1. GlobalKey<NavigatorState> navigatorKey = const GlobalObjectKey<NavigatorState>('AliceNavigatorState'),
  2. @Deprecated('This value is not used anymore. ' 'Theme.of(context).brightness is used instead') bool darkTheme = false,
  3. AliceCustomColors customColors = const AliceCustomColors(),
  4. void quickShareAction(
    1. AliceHttpCall aliceHttpCall
    )?,
})

Creates alice instance. Usage Example

Alice()
  customColors: AliceCustomColors(
    red: Colors.red,
    green: Colors.blue
  )
)

Implementation

factory Alice({
  GlobalKey<NavigatorState> navigatorKey =
      const GlobalObjectKey<NavigatorState>('AliceNavigatorState'),
  @Deprecated(
    'This value is not used anymore. '
    'Theme.of(context).brightness is used instead',
  )
  bool darkTheme = false,
  AliceCustomColors customColors = const AliceCustomColors(),
  void Function(AliceHttpCall aliceHttpCall)? quickShareAction,
}) {
  final defaultQuickShareAction = (call) {
    SharePlus.instance.share(
      ShareParams(
        text: call.getCurlCommand(),
        subject: 'cURL Command',
      ),
    );
  };
  final aliceCore = AliceCore(
    navigatorKey,
    customColors,
    quickShareAction ?? defaultQuickShareAction,
  );
  final httpClientAdapter = AliceHttpClientAdapter(aliceCore);
  final httpAdapter = AliceHttpAdapter(aliceCore);

  return Alice._(
      darkTheme, navigatorKey, aliceCore, httpClientAdapter, httpAdapter);
}