out_of_context 2.0.0 copy "out_of_context: ^2.0.0" to clipboard
out_of_context: ^2.0.0 copied to clipboard

Out of Context provides context-free navigation & scaffolds in Flutter.

Out of Context - Context-free navigation & scaffolds #

Out of Context Build Codecov Pub Dev Documentation

Navigation in Flutter involves a great deal of ceremony as a BuilderContext must always be passed to a Navigator. A BuilContext must be passed down from a Widget to the calling method, which is needlessly verbose. It also makes testing hard as the navigation methods are static and cannot be mocked.

Out of Context provides (over-glorified) wrappers for context-free navigation and scaffolds.

Please view the stable brunch for a production version.


Using out_of_context #

To import the library, add the following dependency to your project.

dependencies:
  out_of_context: ^1.1.1

Then, use any of the Mixins provided.

import 'package:out_of_context/out_of_context.dart';

class Fancy with DispatcherMixin {

  // router is provided by the DispatcherMixin
  // Look Ma, no BuildContexts!
  void back() => dispatcher.pop();

}

Mock of Context #

Mock of Context is a companion project that provides mocks to simplify testing.

Please see the project here.

0
likes
120
pub points
0%
popularity

Publisher

verified publisherforuslabs.com

Out of Context provides context-free navigation & scaffolds in Flutter.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, meta

More

Packages that depend on out_of_context