BindingsBuilder<T> class

Simplifies Bindings generation from a single callback. To avoid the creation of a custom Binding instance per route.

Example:

GetPage(
  name: '/',
  page: () => Home(),
  // This might cause you an error.
  // binding: BindingsBuilder(() => Get.put(HomeController())),
  binding: BindingsBuilder(() { Get.put(HomeController(); })),
  // Using .lazyPut() works fine.
  // binding: BindingsBuilder(() => Get.lazyPut(() => HomeController())),
),
Inheritance

Constructors

BindingsBuilder(BindingBuilderCallback builder)
WARNING: don't use ()=> Get.put(Controller()), if only passing 1 callback use BindingsBuilder.put(Controller()) or BindingsBuilder(()=> Get.lazyPut(Controller()))
BindingsBuilder.put(InstanceBuilderCallback<T> builder, {String tag, bool permanent = false})
Shortcut to register 1 Controller with Get.put(), Prevents the issue of the fat arrow function with the constructor. BindingsBuilder(() => Get.put(HomeController())), [...]
factory

Properties

builder BindingBuilderCallback
Register your dependencies in the builder callback.
final
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

dependencies() → void
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited