loadingTransition method Null safety

Future<void> loadingTransition(
  1. {required BuildContext context,
  2. required Function task,
  3. String? image,
  4. String? text,
  5. dynamic onFail(
    1. {required dynamic error,
    2. required MojoResult result}
    )?,
  6. Widget? target,
  7. bool pop = true}
)

Implementation

Future<void> loadingTransition(
    {required BuildContext context,
    required Function task,
    String? image,
    String? text,
    Function({required dynamic error, required MojoResult result})? onFail,
    Widget? target,
    bool pop = true}) async {
  await Navigator.push(
    context,
    FadeRoute(
      page: LoadingPage<void>(
        image: image,
        text: text,
        task: () async {
          await task();
        },
        onFail: onFail,
        target: target,
        pop: pop,
      ),
    ),
  );
}