getWithParam<T, P> method

T getWithParam<T, P>(
  1. P param, {
  2. Qualifier? qualifier,
})

Return single definition instance for T Use when it is necessary to pass parameters to the instance.

class Page extends StatelessWidget {
 final bloc = getWithParams<CouterBloc>();
 @override
 Widget build(BuildContext context) {
   return Container(
     child: Text(bloc.state.toString()),
   );
 }
}

Return single definition instance for Example of use:

First, you need to define the definition for And your module must be started in so that it is possible to resolve the instance.

var blocModule = Module()..single((s) => Bloc());

Implementation

T getWithParam<T, P>(P param, {Qualifier? qualifier}) {
  return getKoin().getWithParam<T, P>(param, qualifier: qualifier);
}