handle method

  1. @override
Future<bool> handle(
  1. Report report,
  2. BuildContext? context
)
override

Method called when report has been accepted by user

Implementation

@override
Future<bool> handle(Report report, BuildContext? context) async {
  if (ApplicationProfileManager.isAndroid() ||
      ApplicationProfileManager.isIos() ||
      ApplicationProfileManager.isWeb()) {
    await Fluttertoast.showToast(
      msg: _getErrorMessage(report),
      toastLength: _getLength(),
      gravity: _getGravity(),
      timeInSecForIosWeb: _getLengthIos(),
      backgroundColor: backgroundColor,
      textColor: textColor,
      fontSize: textSize,
    );
  } else {
    Future.delayed(
      const Duration(milliseconds: 500),
      () {
        Navigator.push<void>(
          context!,
          PageRouteBuilder(
            opaque: false,
            pageBuilder: (_, __, ___) => FlutterToastPage(
              _getErrorMessage(report),
              _getGravity(),
              Duration(seconds: _getLengthIos()),
              backgroundColor,
              textColor,
              textSize,
            ),
          ),
        );
      },
    );
  }

  return true;
}