CLI Setup: If you create a new Neo project using the Neo CLI, NeoInitializer will be fully configured for you inside
main.dart
with proper initialization timing and error handling.Example
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()
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.Return Value
A Future that completes when all Neo systems have been successfully initialized. Always await this Future or use
.then()
before calling runApp()
.Best Practices
- Call Early: Always call
NeoInitializer.initialize()
in yourmain()
function beforerunApp()
. - 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, making it easy to track startup performance and debug initialization issues.