Is your feature request related to a problem? Please describe.
I would like to give my users a share ability for Logs without showing the logs to them.
Describe the solution you'd like
I would like to use the "Share" Feature of talker_flutter as a standalone function exported by talker_flutter.
Describe alternatives you've considered
Copying the code from the talker_view.dart all the way to the download utility.
This works but a convenience function would be great.
Additional context
|
Future<void> _shareLogsInFile() async { |
|
await _controller.downloadLogsFile( |
|
widget.talker.history.text(timeFormat: widget.talker.settings.timeFormat), |
|
); |
|
} |
|
Future<void> downloadLogsFile(String logs) async => await downloadFile(logs); |
|
import 'dart:io'; |
|
|
|
import 'package:path_provider/path_provider.dart'; |
|
import 'package:share_plus/share_plus.dart'; |
|
|
|
Future<void> downloadFile(String logs) async { |
|
final dir = await getTemporaryDirectory(); |
|
final dirPath = dir.path; |
|
final fmtDate = DateTime.now().toString().replaceAll(":", " "); |
|
final file = |
|
await File('$dirPath/talker_logs_$fmtDate.txt').create(recursive: true); |
|
await file.writeAsString(logs); |
|
await SharePlus.instance.share( |
|
ShareParams(files: <XFile>[XFile(file.path)]), |
|
); |
|
} |
Sidenote:
donwload_logs.dart has a typo
Is your feature request related to a problem? Please describe.
I would like to give my users a share ability for Logs without showing the logs to them.
Describe the solution you'd like
I would like to use the "Share" Feature of talker_flutter as a standalone function exported by talker_flutter.
Describe alternatives you've considered
Copying the code from the talker_view.dart all the way to the download utility.
This works but a convenience function would be great.
Additional context
talker/packages/talker_flutter/lib/src/ui/talker_view.dart
Lines 236 to 240 in 654391c
talker/packages/talker_flutter/lib/src/controller/talker_view_controller.dart
Line 66 in 654391c
talker/packages/talker_flutter/lib/src/utils/download_logs/download_logs_native.dart
Lines 1 to 16 in 654391c
Sidenote:
donwload_logs.dart has a typo