download static method

Future<void> download({
  1. List<RxSession>? sessions,
  2. SessionId? sessionId,
  3. String? userAgent,
  4. MyUser? myUser,
  5. DeviceToken? token,
  6. bool? pushNotifications,
})

Creates and downloads the report as a .txt file.

Implementation

static Future<void> download({
  List<RxSession>? sessions,
  SessionId? sessionId,
  String? userAgent,
  MyUser? myUser,
  DeviceToken? token,
  bool? pushNotifications,
}) async {
  try {
    final encoder = Utf8Encoder();

    final file = await PlatformUtils.createAndDownload(
      'report_${DateTime.now().millisecondsSinceEpoch}.log',
      encoder.convert(
        LogController.report(
          sessions: sessions,
          sessionId: sessionId,
          userAgent: userAgent,
          myUser: myUser,
          token: token,
          pushNotifications: pushNotifications,
        ),
      ),
    );

    if (file != null && PlatformUtils.isMobile) {
      await SharePlus.instance.share(ShareParams(files: [XFile(file.path)]));
    }
  } catch (e) {
    MessagePopup.error(e);
  }
}