-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Is there an existing issue for this?
- I have searched the existing issues.
Which plugins are affected?
Storage
Which platforms are affected?
Windows
Description
channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
everytime i upload to firebase i get this warning so on the released build of windows it makes the app crash so what is the issue?
this my code i use to upload
Future<String?> _uploadImageToFirebase(Item item, File imageFile, String userUid) async {
try {
if (item.imagePath != null && item.imagePath!.startsWith('http')) {
Reference oldImageRef = FirebaseStorage.instance.refFromURL(item.imagePath!);
await oldImageRef.delete();
}
String filePath = '$userUid/Items_Images/${item.uuid}/${item.uuid}.jpg';
UploadTask uploadTask = FirebaseStorage.instance.ref(filePath).putFile(imageFile);
TaskSnapshot snapshot = await uploadTask;
String downloadURL = await snapshot.ref.getDownloadURL();
await FirebaseFirestore.instance.collection('users').doc(userUid).collection('items').doc(item.uuid).update({'imagePath': downloadURL});
return downloadURL;
} catch (e) {
return null;
}
}
final firebaseStorage = FirebaseStorage.instance;
List successfullyUploadedItems = [];
for (var item in updateImage) {
if (item.imagePath != null && !item.imagePath!.startsWith('http')) {
// Add a timeout for the upload
String? downloadURL = await _uploadImageToFirebase(item, File(item.imagePath!), currentUser.uid).timeout(Duration(seconds: 5), onTimeout: () {
throw Exception("Upload timeout for item: ${item.uuid}");
});
if (downloadURL != null) {
item.imagePath = downloadURL;
successfullyUploadedItems.add(item.uuid);
} else {}
}
}
updateImage.removeWhere((item) => successfullyUploadedItems.contains(item.uuid));
so what is the issue?
Reproducing the issue
the function provided.
Firebase Core version
3.8.1
Flutter Version
3.24.3
Relevant Log Output
[ERROR:flutter/shell/common/shell.cc(1065)] The 'plugins.flutter.io/firebase_storage/taskEvent/75592faa-c7e7-43a2-8847-2db75500a494' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.Flutter dependencies
name: cashgo
description: "CashGo"
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=3.5.3 <4.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: ^0.19.0
http: ^1.2.2
intl_translation: ^0.20.1
syncfusion_flutter_charts: ^27.1.57
provider: ^6.0.0
keyboard_actions: ^4.2.0
cloud_firestore: ^5.5.1
firebase_analytics: ^11.3.3
firebase_auth: ^5.3.4
firebase_core: ^3.8.1
shared_preferences: ^2.3.2
connectivity_plus: ^6.0.5
font_awesome_flutter: ^10.7.0
google_sign_in: ^6.2.1
google_fonts: ^6.2.1
window_manager: ^0.4.2
cupertino_icons: ^1.0.8
uuid: ^4.5.1
collection: ^1.18.0
firebase_analytics_platform_interface: ^4.2.3
firebase_analytics_web: ^0.5.10
firebase_storage: ^12.3.7
network_info_plus: ^6.0.2
permission_handler: ^11.3.1
path_provider: ^2.1.4
excel: ^4.0.6
path: ^1.9.0
share_plus: ^10.0.3
mime: ^2.0.0
ffi: ^2.1.3
win32: ^5.9.0
image: ^3.3.0
flutter_secure_storage: ^9.2.2
open_file: ^3.5.10
pdf: ^3.1.0
number_to_words_english: ^2.0.2
number_to_word_arabic: ^0.0.8
file_picker: ^8.1.2
esc_pos_utils: ^1.1.0
flutter_blue_plus: ^1.34.5
flutter_blue_plus_windows: ^1.24.22
dev_dependencies:
flutter_launcher_icons: ^0.11.0
flutter_test:
sdk: flutter
barcode: ^2.2.8
flutter_lints: ^5.0.0
mockito: ^5.0.16
build_runner: ^2.1.7
flutter_icons:
android: true
ios: true
image_path: "assets/icon.png"
flutter:
uses-material-design: true
generate: true
assets:
- lib/l10n/
- assets/animated_logo.gif
- assets/earth.gif
- assets/icon.png
- assets/background.png
- assets/pictureDots.png
- assets/sounds/beep.wav
fonts:
- family: Amiri
fonts:
- asset: assets/fonts/Amiri-Regular.ttf
Additional context and comments
No response