-
Notifications
You must be signed in to change notification settings - Fork 21
Description
I am currently getting this error when displaying the markdown widget in my code only on my windows app:
[ERROR:flutter/shell/common/shell.cc(1015)] The 'plugins.flutter.io/firebase_firestore/document/6ce84a75-109b-40fa-92b8-8f1634df60ae' 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.
When checking for Platform.isWindows and only showing a Text field instead, my app works fine.
Here is my widget:
Widget buildMarkdownViewer(
final markdown,
final BuildContext context,
) {
return ClipRRect(
borderRadius: BorderRadius.circular(15),
child: SingleChildScrollView(
reverse: true,
child: MarkdownViewer(
markdown,
enableTaskList: true,
enableSuperscript: false,
enableSubscript: false,
enableFootnote: false,
enableImageSize: false,
enableKbd: false,
highlightBuilder: (text, language, infoString) {
final prism = Prism(
mouseCursor: SystemMouseCursors.text,
style: Theme.of(context).brightness == Brightness.dark
? const PrismStyle.dark()
: const PrismStyle(
token: TextStyle(color: Color(0xff90a4ae)),
atrule: TextStyle(color: Color(0xff0000fa)),
attrName: TextStyle(color: Color(0xff39adb5)),
attrValue: TextStyle(color: Color(0xfff6a434)),
bold: TextStyle(fontWeight: FontWeight.bold),
boolean:
TextStyle(color: Color.fromRGBO(193, 151, 249, 1)),
builtin: TextStyle(color: Color(0xff39adb5)),
cdata: TextStyle(color: Color(0xff39adb5)),
char: TextStyle(color: Color(0xff39adb5)),
className:
TextStyle(color: Color.fromRGBO(80, 184, 253, 1)),
comment:
TextStyle(color: Color.fromRGBO(114, 122, 138, 1)),
constant: TextStyle(color: Color(0xff0000fa)),
deleted: TextStyle(color: Color(0xffe53935)),
doctype: TextStyle(color: Color(0xff989898)),
entity: TextStyle(color: Color(0xffe53935)),
function:
TextStyle(color: Color.fromRGBO(248, 211, 129, 1)),
important: TextStyle(
color: Color(0xff0000fa),
fontWeight: FontWeight.bold),
inserted: TextStyle(color: Color(0xff39adb5)),
italic: TextStyle(fontStyle: FontStyle.italic),
keyword:
TextStyle(color: Color.fromRGBO(220, 148, 81, 1)),
namespace: TextStyle(color: Color(0xb3000000)),
number:
TextStyle(color: Color.fromRGBO(185, 142, 235, 1)),
operator:
TextStyle(color: Color.fromRGBO(206, 133, 91, 1)),
prolog: TextStyle(color: Color(0xff989898)),
property: TextStyle(color: Color(0xff39adb5)),
punctuation: TextStyle(color: Color(0xff39adb5)),
regex: TextStyle(color: Color(0xff6182b8)),
selector: TextStyle(color: Color(0xffe53935)),
string:
TextStyle(color: Color.fromRGBO(221, 254, 144, 1)),
symbol: TextStyle(color: Color(0xff0000fa)),
tag: TextStyle(color: Color(0xffe53935)),
url: TextStyle(color: Color(0xffe53935)),
));
return prism.render(text, language ?? 'plain');
},
styleSheet: MarkdownStyle(
listItemMarkerTrailingSpace: 12,
codeSpan: const TextStyle(
fontFamily: 'Menlo',
),
codeblockDecoration: BoxDecoration(
border: Border.all(width: 10, color: Colors.transparent),
borderRadius: BorderRadius.circular(15),
color: const Color.fromRGBO(32, 36, 47, 1),
),
codeBlock: const TextStyle(
fontSize: 12,
letterSpacing: -0.3,
fontFamily: 'Menlo',
color: Color.fromRGBO(195, 193, 188, 1)),
),
),
),
);
}