flutter

Future<List<Dynamic>> does not match the return type Future<List<DropzoneFileInterface>>


I am currently creating an application in which I wrote a function to be able to get images from the web with specific extensions but there is an error here that I don't know how to solve Help me

text error

/C:/Users/sina%20saffar/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_dropzone_web-3.0.13/lib/flutter_dropzone_plugin.dart:64:25: Error: The return type of the method 'FlutterDropzonePlugin.pickFiles' is 'Future<List<dynamic>>', which does not match the return type, 'Future<List<DropzoneFileInterface>>', of the overridden method, 'FlutterDropzonePlatform.pickFiles'.
 - 'Future' is from 'dart:async'.
 - 'List' is from 'dart:core'.
 - 'DropzoneFileInterface' is from 'package:flutter_dropzone_platform_interface/dropzone_file_interface.dart' ('/C:/Users/sina%20saffar/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_dropzone_platform_interface-2.2.0/lib/dropzone_file_interface.dart').
Change to a subtype of 'Future<List<DropzoneFileInterface>>'.
  Future<List<dynamic>> pickFiles(bool multiple,
                        ^
/C:/Users/sina%20saffar/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_dropzone_platform_interface-2.2.0/lib/flutter_dropzone_platform_interface.dart:97:39: Context: This is the overridden method ('pickFiles').
  Future<List<DropzoneFileInterface>> pickFiles(bool multiple,

select local image function:

 Future<void> selectLocalImages() async {
    final files = await dropzoneViewController.pickFiles(
      multiple: true,
      mime: ['image/jpeg', 'image/png'],
    );

    if (files.isNotEmpty) {
      for (var file in files) {
        if (file is html.File) {
          final bytes = await dropzoneViewController.getFileData(file);
          final image = ImageModel(
            url: '',
            file: file,
            folder: '',
            filename: file.name,
            localImageToDisplay: Uint8List.fromList(bytes),
          );
          selectedImagesToUpload.add(image);
        }
      }
    }
  }

Solution

  • There is a mismatch between the expected return value and and the actual one , you a are expecting it as Future<List> which it is not sub type of the actual returned value which is Future<List>, Try change it and show me the result.