首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误的状态:使用flutter html呈现html文本时没有元素

错误的状态:使用flutter html呈现html文本时没有元素
EN

Stack Overflow用户
提问于 2021-05-01 19:55:06
回答 1查看 166关注 0票数 0

现在我正在使用flutter html在flutter应用程序中渲染一些文章,这是我的依赖项:

代码语言:javascript
复制
flutter_html: 1.3.0

一切正常,但有时会显示以下错误:

代码语言:javascript
复制
======== Exception caught by widgets library =======================================================
The following StateError was thrown building HtmlParser(dirty):
Bad state: No element

The relevant error-causing widget was: 
  Html file:///Users/dolphin/source/cruise-open/lib/src/page/home/components/articledetail_component/view.dart:168:15
When the exception was thrown, this was the stack: 
#0      ListMixin.firstWhere (dart:collection/list.dart:167:5)
#1      declarationsToStyle.<anonymous closure> (package:flutter_html/src/css_parser.dart:49:52)
#2      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:397:8)
#3      declarationsToStyle (package:flutter_html/src/css_parser.dart:10:16)
#4      inlineCSSToStyle (package:flutter_html/src/css_parser.dart:78:10)

我不知道发生了什么,也不知道如何修复它。这是我在组件中的呈现代码:

代码语言:javascript
复制
Html(
                data: item.content,
                style: {
                  "body": Style(
                    fontSize: FontSize(19.0),
                  ),
                },
                onLinkTap: (url) => CommonUtils.launchUrl(url),
              ),

这是UI的错误:

我该怎么做才能修复它呢?顺便说一下,这是我的html上下文,导致了这个问题:

代码语言:javascript
复制
<p>Microservices is a style of architecture consisting of a small, individual application component with a single responsibility, with a high degree of autonomy in terms of deployment and scalability. These components communicate via a lightweight protocol like REST over HTTP. In consequence, development teams are small (the two-pizza rule), focused on a microservice. In practice the team owns the entire lifecycle from development to deployment — if you built it, you run it. This creates a problem. After all, dev teams' core competency is usually Maven, a microservices framework, say, Spring Boot, test frameworks like JUnit, and so on. But if we look at the steps involved in deploying a microservice:</p>
<ul>
 <li>Package the application in a container like Docker. This involves writing a Dockerfile.</li>
 <li>Deploy the container to an orchestrator like Kubernetes. This involves writing several resources; description files for services, deployment, etc.</li>
</ul>
<p>To use a term familiar to developers, this is an 'impedance mismatch.' To solve this problem, we need a class of tools that speak the language of developers and make the entire deployment steps transparent to them. The most famous of these is <a href="https://github.com/GoogleContainerTools/jib" rel="noopener noreferrer" target="_blank">Jib</a><span style="color: #0563C1; text-decoration: underline;">,</span> which we dealt with in a <a href="https://dzone.com/articles/dockerizing-a-spring-boot-application" rel="noopener noreferrer" target="_blank">previous</a> paper, which builds optimized Docker and <a href="https://github.com/opencontainers/image-spec"><span style="color: windowtext; text-decoration: none;">OCI</span></a> images for your Java applications and is available as a Maven plugin. There are other tools in this category like <a href="https://dekorate.io/dekorate/" rel="noopener noreferrer" target="_blank">Dekorate</a> which allows us to generate Kubernetes manifests using just Maven and Java annotations. The latest and comprehensive entry in this category is JKube from RedHat which our subject <em>de jour.</em></p>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-01 21:46:17

这是一个与text-decoration相关库和flutter 2.0的错误:https://github.com/Sub6Resources/flutter_html/issues/569 https://github.com/Sub6Resources/flutter_html/issues/554

您可以尝试使用此版本:2.0.0-nullsafety.1或删除text-decoration

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67345983

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档