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
-
- Object
- BindingsInterface<
void> - Bindings
- BindingsBuilder
Constructors
- BindingsBuilder(BindingBuilderCallback builder)
-
WARNING: don't use
()=> Get.put(Controller())
, if only passing 1 callback useBindingsBuilder.put(Controller())
orBindingsBuilder(()=> 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.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dependencies(
) → void -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited