showFlushBar function Null safety

Future<void> showFlushBar(
  1. {required bool value,
  2. String textTrue = "",
  3. String textFalse = "",
  4. Duration? duration,
  5. void onPressedMainButton(
      )?,
    1. String? textMainButton}
    )

    Implementation

    Future<void> showFlushBar({
      required bool value,
      String textTrue = "",
      String textFalse = "",
      Duration? duration,
      void Function()? onPressedMainButton,
      String? textMainButton,
    }) async {
      BuildContext context = ModernFormGlobalContext.context!;
      Size size = ModernFormGlobalContext.size;
      num webBreakdown = ModernFormUtils.webBreakdown;
    
      await Flushbar(
        maxWidth: size.width > webBreakdown ? size.width * .2 : null,
        borderRadius: BorderRadius.circular(size.width > webBreakdown ? 8 : 0),
        margin: EdgeInsets.only(
            bottom: ScreenUtil().setHeight(size.width > webBreakdown ? 7 : 0)),
        message: value ? textTrue : textFalse,
        backgroundColor: value ? Colors.green : Colors.red,
        icon: Icon(
          value ? Icons.check : Icons.close,
          color: Colors.white,
        ),
        duration: duration ?? Duration(milliseconds: 1500),
        reverseAnimationCurve: Curves.fastOutSlowIn,
        mainButton: onPressedMainButton != null
            ? TextButton(
                onPressed: onPressedMainButton,
                child: Text(
                  textMainButton ?? "Desfazer",
                  style: TextStyle(
                      color: Colors.white, fontSize: ScreenUtil().setSp(14)),
                ),
              )
            : null,
      ).show(context);
    }