BindingsBuilder<T>.put constructor

BindingsBuilder<T>.put(
  1. InstanceBuilderCallback<T> builder, {
  2. String? tag,
  3. 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())),

Sample:

GetPage(
  name: '/',
  page: () => Home(),
  binding: BindingsBuilder.put(() => HomeController()),
),

Implementation

factory BindingsBuilder.put(InstanceBuilderCallback<T> builder,
    {String? tag, bool permanent = false}) {
  return BindingsBuilder(
      () => GetInstance().put<T>(builder(), tag: tag, permanent: permanent));
}