shareImage method

dynamic shareImage({
  1. required GlobalKey<State<StatefulWidget>> globalKey,
  2. String? msg,
  3. String? nameImage,
})

Implementation

shareImage({required GlobalKey globalKey, String? msg, String? nameImage}) async {
  try {
    //if( CheckPlatform().isMobile ) {
    String image = await getShareImage(globalKey: globalKey);
    final files = <XFile>[];
    files.add(XFile(image, name: 'la_sainte_bible_$nameImage'));
    String msg0 = '$msg';
    msg0 += '\n\n${Constant.appName}\n${Constant.urlAppCCGMobileOnly()}';
    Share.shareXFiles(files, text: msg0, subject: '${tr('label_Partager')}');
  } catch (ex, trace) {
    logError(ex, trace: trace, position: 'shareImage');
  }
}