LView<T>.put constructor

LView<T>.put(
  1. T create(), {
  2. Key? key,
  3. String? tag,
  4. bool permanent = false,
  5. required Widget builder(
    1. BuildContext context,
    2. T controller
    ),
  6. Widget orElse(
    1. BuildContext context
    )?,
  7. bool autoWatch = true,
  8. List<Object?>? args,
})

Registers and consumes a dependency of type T.

Implementation

factory LView.put(
  T Function() create, {
  Key? key,
  String? tag,
  bool permanent = false,
  required Widget Function(BuildContext context, T controller) builder,
  Widget Function(BuildContext context)? orElse,
  bool autoWatch = true,
  List<Object?>? args,
}) {
  return LView<T>(
    key: key,
    resolver: (context) =>
        context.levit.put<T>(create, tag: tag, permanent: permanent),
    builder: builder,
    orElse: orElse,
    autoWatch: autoWatch,
    args: args,
  );
}