Hello everyone! Today I faced a problem with uploading files. I created a stack with 2 elements - IconButton which can upload photo by clicking on it and Image which changes when photo is uploaded. IconButton is visible at first and when the file is uploaded, IconButton disappears and Image appears. Appearing and disappearing depends on the Is data uploading option. I upload files via widget state and then upload them to Firestore. But when I try to launch the app, there is a problem:
lib/pages/main_pages/anket_pages/anket_create/anket_create_widget.dart:1143:53: Error: The argument type 'Object' can't be assigned to the parameter type 'Uint8List'.
- 'Object' is from 'dart:core'.
- 'Uint8List' is from 'dart:typed_data'.
? _model.uploadedLocalFile2
^
lib/pages/main_pages/anket_pages/anket_create/anket_create_widget.dart:2249:39: Error: A value of type 'Object' can't be assigned to a variable of type 'List<FFUploadedFile>'.
- 'Object' is from 'dart:core'.
- 'List' is from 'dart:core'.
- 'FFUploadedFile' is from 'package:sunlite/flutter_flow/uploaded_file.dart' ('lib/flutter_flow/uploaded_file.dart').
? _model.uploadedLocalFile2
^
lib/pages/main_pages/anket_pages/anket_edit/anket_edit_widget.dart:1174:59: Error: The argument type 'Object' can't be assigned to the parameter type 'Uint8List'.
- 'Object' is from 'dart:core'.
- 'Uint8List' is from 'dart:typed_data'.
? _model
^
lib/pages/main_pages/anket_pages/anket_edit/anket_edit_widget.dart:2005:49: Error: A value of type 'Object' can't be assigned to a variable of type 'List<FFUploadedFile>'.
- 'Object' is from 'dart:core'.
- 'List' is from 'dart:core'.
- 'FFUploadedFile' is from 'package:sunlite/flutter_flow/uploaded_file.dart' ('lib/flutter_flow/uploaded_file.dart').
? _model.uploadedLocalFile2
^
lib/pages/main_pages/anket_pages/add_photos/add_photos_widget.dart:285:45: Error: The argument type 'Object' can't be assigned to the parameter type 'Uint8List'.
- 'Object' is from 'dart:core'.
- 'Uint8List' is from 'dart:typed_data'.
? _model.uploadedLocalFile2
^
lib/pages/main_pages/anket_pages/add_photos/add_photos_widget.dart:441:45: Error: The argument type 'Object' can't be assigned to the parameter type 'Uint8List'.
- 'Object' is from 'dart:core'.
- 'Uint8List' is from 'dart:typed_data'.
? _model.uploadedLocalFile4
^
lib/pages/main_pages/anket_pages/add_photos/add_photos_widget.dart:597:45: Error: The argument type 'Object' can't be assigned to the parameter type 'Uint8List'.
- 'Object' is from 'dart:core'.
- 'Uint8List' is from 'dart:typed_data'.
? _model.uploadedLocalFile6
^
Target kernel_snapshot_program failed: Exception
FAILURE: Build failed with an exception.
As I understood, problem with FlutterFlow uploading, files try to upload as Object, and expected Bytes. But really I can't understood, what I'm doing incorrect.
Problem occurs here:
child: Image.memory(
_model.isDataUploading2
? _model.uploadedLocalFile2
: _model.uploadedLocalFile1.bytes ?? Uint8List.fromList([]),
Upload field seem like that:
I'm trying to search this problem in Google and FlutterFlow Community, but I can't find any helpful solutions. Hoping for your help. Have a nice day!