Overview
OneContext is a Flutter/Dart package that simplifies handling dialogs, overlays, navigation, and access to theme and media query data without requiring a BuildContext. It provides global methods to manage app state and UI interactions across the entire widget tree, making it easier to show alerts, navigate, or retrieve context-sensitive values from anywhere in the app. Ideal for reducing boilerplate and improving code maintainability in complex Flutter applications.
Use cases
- Showing dialogs without BuildContext
- Global navigation across the app
- Accessing theme and media query data globally
- Managing overlays and popups
- Simplifying state management for UI elements
- Reducing dependency on BuildContext in utility functions
Key features
- No need for BuildContext
- Global dialog and overlay management
- Easy navigation from any location
- Access to Theme and MediaQuery globally
- Minimal boilerplate code
- Cross-platform support
Suitable for
- Large-scale Flutter apps
- Developers seeking simpler context handling
- Apps with frequent dialogs and overlays
- Teams wanting consistent UI behavior
- Projects aiming to reduce BuildContext dependencies
- Utility functions needing global access
Considerations
- May bypass standard widget lifecycle
- Potential for overuse in simple cases
- Requires careful state management
- Not suitable for deeply nested context-specific logic
- Limited debugging visibility
- Best used with clear architectural boundaries