0

I'm getting the below error, I'm creating a custom action in flutter flow.

Error: The argument type 'String?' can't be assigned to the parameter type 'Object' because 'String?' is nullable and 'Object' isn't.

code

// Automatic FlutterFlow imports
import '/backend/backend.dart';
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!

// Set your action name, define your arguments and return parameter,
// and then add the boilerplate code using the button on the right!

import 'package:image_downloader_web/image_downloader_web.dart';

final WebImageDownloader _webImageDownloader = WebImageDownloader();

Future imagedownloaderweb(String url) async {
  // Add your function code here!
  await _webImageDownloader.downloadImageFromWeb(url);
}

flutter-flow-custom-widget

image_downloader_web

mu9u1t
  • 55
  • 1
  • 6

1 Answers1

0

All methods on WebImageDownloader are static, you should not instantiate an instance of this class via WebImageDownloader().

Instead you can directly call

WebImageDownloader.downloadImageFromWeb(url);

More info in the source code here or documentation here

jraufeisen
  • 3,005
  • 7
  • 27
  • 43
  • Instance member 'downloadImageFromWeb' can't be accessed using static access. – mu9u1t Jun 05 '23 at 21:56
  • Pardon, I did not notice you were using version 1.0.2 of `image_downloader_web`. If possible for you, you should probably update to the latest version 2.0.2 – jraufeisen Jun 05 '23 at 22:02
  • Latest Version doesn't works across all platforms. This one does. – mu9u1t Jun 05 '23 at 22:05