registerRouteBloc method

Code registerRouteBloc({
  1. required String routeType,
  2. String? routeTypeImport,
  3. Code? extra,
  4. bool usePageBuilder = false,
})

Implementation

Code registerRouteBloc(
    {required String routeType,
    String? routeTypeImport,
    Code? extra,
    bool usePageBuilder = false}) {
  return Block.of([
    const Code('return '),
    Reference(routeType, routeTypeImport).code,
    usePageBuilder
        ? Code(
            '<$processedReturnType>(pageBuilder: (context, animation, secondaryAnimation) => ')
        : Code('<$processedReturnType>(builder: (context) => '),
    joinedConstructerParams,
    const Code(', settings: data,'),
    if (extra != null) extra,
    if (fullscreenDialog) const Code('fullscreenDialog:true,'),
    if (!maintainState) const Code('maintainState:false,'),
    const Code(');')
  ]);
}