wrappedRoute method

  1. @override
Widget wrappedRoute(
  1. BuildContext context
)

clients will implement this method to return their wrapped routes

Implementation

@override
Widget wrappedRoute(BuildContext context) {
  return MultiBlocProvider(
    providers: [
      BlocProvider(create:  (context) => LocationBloc(location: Location()),),
      BlocProvider(create: (context) {
    ComplaintsRegistrationState initialState;

    final pgrItem = pgrServiceModel;

    if (pgrItem != null) {
      final additionalDetails = PgrAdditionalDetails.fromJson(
        jsonDecode(pgrItem.additionalDetail!),
      );

      initialState = ComplaintsRegistrationViewState(
        complaintType: pgrItem.serviceCode,
        addressModel: pgrItem.address,
        complaintsDetailsModel: ComplaintsDetailsModel(
          administrativeArea: pgrItem.address.locality?.name ?? '',
          complainantContactNumber: pgrItem.user.mobileNumber ?? '',
          complainantName: pgrItem.user.name ?? '',
          complaintDescription: pgrItem.description,
          complaintRaisedFor:

          ComplaintsSingleton().userMobileNumber != pgrItem.user.mobileNumber
              ? 'Another user'
              : 'Myself',

          dateOfComplaint: pgrItem.auditDetails?.createdTime.toDateTime ??
              DateTime.now(),
          supervisorContactNumber:
          additionalDetails.supervisorContactNumber ?? '',
          supervisorName: additionalDetails.supervisorName ?? '',
        ),
      );
    } else {
      initialState = const ComplaintsRegistrationCreateState();
    }

    return ComplaintsRegistrationBloc(
      initialState,

      pgrServiceRepository:
      context.repository<PgrServiceModel, PgrServiceSearchModel>(context),

    );
  },
      )
    ],

    child: this,
  );
}