> ## Documentation Index
> Fetch the complete documentation index at: https://neo.tvk.company/llms.txt
> Use this file to discover all available pages before exploring further.

# Initializer

> Essential initialization utility that sets up core Neo framework components including haptics, syntax highlighting, and logging systems before your app starts.

<Note>
  **CLI Setup**: If you create a new Neo project using the [Neo CLI](/cli/commands), NeoInitializer will be fully configured for you inside `main.dart` with proper initialization timing and error handling.
</Note>

## Example

<CodeGroup>
  ```dart Complete Setup lines focus={10-16} theme={null}
  import 'package:flutter/widgets.dart';
  import 'package:neo/neo.dart';
  import 'package:hooks_riverpod/hooks_riverpod.dart';

  import 'router/neo_router.dart';

  void main() async {
    WidgetsFlutterBinding.ensureInitialized();

    NeoInitializer.initialize().then((_) {
      runApp(
        ProviderScope(
          child: MyApp(),
        ),
      );
    });
  }

  class MyApp extends ConsumerWidget {
    const MyApp({super.key});

    @override
    Widget build(BuildContext context, WidgetRef ref) {
      final neoRouter = ref.watch(routerProvider);

      return NeoApp(
        title: "My Neo App",
        routerConfig: neoRouter.config(),
      );
    }
  }
  ```
</CodeGroup>

## What Gets Initialized

NeoInitializer sets up essential Neo framework components and systems required for your app to function properly. The initialization process automatically detects your platform and configures the appropriate features.

## Methods

### NeoInitializer.initialize()

<Warning>
  **Required Setup**: You must call `WidgetsFlutterBinding.ensureInitialized()` before calling `NeoInitializer.initialize()`. This ensures Flutter's binding is properly initialized before Neo's systems start up.
</Warning>

Initializes all core Neo framework systems asynchronously. This method must be called before your app starts.

#### Return Value

<ParamField path="returns" type="Future<void>">
  A Future that completes when all Neo systems have been successfully initialized. Always await this Future or use `.then()` before calling `runApp()`.
</ParamField>

## Best Practices

* **Call Early**: Always call `NeoInitializer.initialize()` in your `main()` function before `runApp()`.
* **Ensure Binding**: Call `WidgetsFlutterBinding.ensureInitialized()` before initialization to ensure Flutter is ready.
* **Await Completion**: Always await the initialize call or use `.then()` to ensure initialization completes before your app starts.

## Integration Notes

* **Platform Support**: Initialization automatically detects the current platform and initializes only supported features. Unsupported features are safely skipped.
* **Logging**: Initialization progress is automatically logged using [NeoLogger](/utilities/logger), making it easy to track startup performance and debug initialization issues.
