首页 > 解决方案 > Flutter Html View 导入时返回错误

问题描述

我已经成功在pubspec.yaml中安装了依赖,退出代码为0。当我import 'package:flutter_html_view/flutter_html_view.dart';显示它已通过vs代码导入(它强调它是导入但未使用)**

但是当我保存或重新启动我的模拟器时,它会拒绝构建。返回以下错误:

/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_markdown-0.2.0/lib/src/builder.dart:326:49: Error: The getter 'children' isn't defined for the class 'InlineSpan'.

 - 'InlineSpan' is from 'package:flutter/src/painting/inline_span.dart' ('/C:/src/flutter/packages/flutter/lib/src/painting/inline_span.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'children'.
        List<TextSpan> children = previous.text.children != null
                                                ^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_markdown-0.2.0/lib/src/builder.dart:327:41: Error: The getter 'children' isn't defined for the class 'InlineSpan'.

 - 'InlineSpan' is from 'package:flutter/src/painting/inline_span.dart' ('/C:/src/flutter/packages/flutter/lib/src/painting/inline_span.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'children'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'children'.
          ? new List.from(previous.text.children)
                                        ^^^^^^^^

/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_markdown-0.2.0/lib/src/builder.dart:326:49: Error: The getter 'children' isn't defined for the class 'InlineSpan'.
 - 'InlineSpan' is from 'package:flutter/src/painting/inline_span.dart' ('/C:/src/flutter/packages/flutter/lib/src/painting/inline_span.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'children'.
        List<TextSpan> children = previous.text.children != null
                                                ^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_markdown-0.2.0/lib/src/builder.dart:327:41: Error: The getter 'children' isn't defined for the class 'InlineSpan'.
 - 'InlineSpan' is from 'package:flutter/src/painting/inline_span.dart' ('/C:/src/flutter/packages/flutter/lib/src/painting/inline_span.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'children'.

          ? new List.from(previous.text.children)
                                        ^^^^^^^^```

标签: flutterdart

解决方案


您的 SDK 限制是什么?您使用的是 2018 年的一个非常旧的版本 ( 0.2.0) package:flutter_markdown,早在 Flutter 甚至还稳定之前。使用最新的兼容版本^0.6.2理想情况下)应该可以解决您的问题。


推荐阅读