forceReportsSending method

Future<void> forceReportsSending()

This method forces the sending of the crashlytics.

This method is only used if the _autoCrashlyticsSent is false. If it's true, the crashlytics will be sent automatically at the application next start.

If _crashlyticsEnabled is false, but there are logs saved in crashlytics, they will be sent to Firebase Crashlytics.

If the current platform is not supported, the method does nothing.

Implementation

Future<void> forceReportsSending() async {
  if (!isPlatformSupported || _autoCrashlyticsSent) {
    // This not relevant to force reports sending if auto sent is enabled
    // Or if the platform is not supported
    return;
  }

  final isThereUnsentReport = await _crashlytics.checkForUnsentReports();
  if (!isThereUnsentReport) {
    // Nothing to send
    return;
  }

  return FirebaseCrashlytics.instance.sendUnsentReports();
}