I am creating a flutter application using firebase_firestore, I have a function that return a stream, when running the function, the following gets printed in the terminal:
[ERROR:flutter/shell/common/shell.cc(1055)] The ‘plugins.flutter.io/firebase_firestore/query/bce7f964-b8c0-4e73-b40d-a9d3aa5c6fbd’ 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.
the code of both functions are:
static Stream<int> getItemCountStream() {
return _folderRef.snapshots().map((snapshot) => snapshot.size);
}
static Stream<List<ItemModel>> getItems() {
return _folderRef.snapshots().map(
(snapshot) => snapshot.docs.map(
(doc) {
return ItemModel.fromJson(doc.data());
},
).toList(),
);
}
I tried writing the functions using isolates, but with no success