如何将 HTML file/template 传递给 Flutter 中的 Mailer 包“...html”参数?
How can I pass an HTML file/template to the Mailer package "...html" parameter in Flutter?
所以我在 flutter 中使用 Mailer 包 https://pub.dev/packages/mailer, and its great and everything but one problem im facing is that i want to pass a complex HTML template/file to the Mailer's package "...html" parameter instead of a simple one. The way i wanna approach this problem is through creating a separate file (heard it could be a dart file and write HTML in it P.S. please show me how), and then pass this file to the "...html" parameter in the Mailer package. Please tell me how is this possible in flutter. My Code
在这种情况下,建议使用原始 String
定义:
final String html = '''
very long html here
'''
final Message = Message()
..html = html;
更好的方法是在单独的文件中定义 HTML
模板:
//html_template.dart
library html_template;
final String html = '''
<html></html>
'''; // very long html template definition
并在需要时导入:
import './html_template.dart' as Template;
void main() {
final Message = Message()..html = Template.html;
}
所以我在 flutter 中使用 Mailer 包 https://pub.dev/packages/mailer, and its great and everything but one problem im facing is that i want to pass a complex HTML template/file to the Mailer's package "...html" parameter instead of a simple one. The way i wanna approach this problem is through creating a separate file (heard it could be a dart file and write HTML in it P.S. please show me how), and then pass this file to the "...html" parameter in the Mailer package. Please tell me how is this possible in flutter. My Code
在这种情况下,建议使用原始 String
定义:
final String html = '''
very long html here
'''
final Message = Message()
..html = html;
更好的方法是在单独的文件中定义 HTML
模板:
//html_template.dart
library html_template;
final String html = '''
<html></html>
'''; // very long html template definition
并在需要时导入:
import './html_template.dart' as Template;
void main() {
final Message = Message()..html = Template.html;
}