Error share_plus custom actions

hello, I have this custom action that I copied from this community. Until a few weeks ago it worked without problems, but now I have this error. he pro I have tried several options but I can't solve it.

Any idea how to solve it?

// Automatic FlutterFlow imports
import '/backend/backend.dart';
import '/backend/schema/structs/index.dart';
import '/actions/actions.dart' as action_blocks;
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

import 'package:share_plus/share_plus.dart';
import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:path_provider/path_provider.dart';

Future<int> shared(
  String imgUrl,
  String texto,
) async {
  // Add your function code here!
  final imageurl = imgUrl;
  final uri = Uri.parse(imageurl);
  final response = await http.get(uri);
  final bytes = response.bodyBytes;
  final temp = await getTemporaryDirectory();
  final path = '${temp.path}/image.png';
  final imagen_temporal = '${temp.path}/image.png';

  File(path).writeAsBytesSync(bytes);

  //await Share.shareFiles([path]);
  final files = <XFile>[];

  var xfile = XFile(
    imagen_temporal,
  );
  files.add(xfile);
  final result = await Share.shareXFiles(files, text: texto);

  if (result.status == ShareResultStatus.success) {
    return 1;
  } else {
    return 0;
  }
}
1
6 replies