'_File' is not a subtype of type 'String' in type cast '_File' is not a subtype of type 'String' in type cast dart dart

'_File' is not a subtype of type 'String' in type cast


files in your code looks like plural, but your code doesn't show details.

This is the code to get a single file and this is sent as an array where more than one entry can be added[fileContentBase64] or [file1ContentBase64, file2ContentBase64, file3ContentBase64]

import 'dart:convert';...var fileContent = file.readAsBytesSync();var fileContentBase64 = base64.encode(fileContent); var response = await http.post("http://206.189.92.174:4000/API/Posts/Cube_Post_Submit",    body :       {        'attachments' : [fileContentBase64] ,       'User_Id' : "5acc5d6e1295332c28f7e205",       'Cubes_Id' : jsonstring,       'Post_Text' : "hello",       'Post_Category' : "Story",       'Post_Link': ""       }    );   print(response.body);


You can use the detailed example here that will help you achieve your goals.