Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad state: No element #569

Closed
roeniss opened this issue Mar 4, 2021 · 16 comments
Closed

Bad state: No element #569

roeniss opened this issue Mar 4, 2021 · 16 comments

Comments

@roeniss
Copy link

roeniss commented Mar 4, 2021

I failed to parse html, but can't figure out why it happens because there are few log to check out.

<div class="substance">
									<p><br></p><p align="center" style="margin: 1em 0px; text-align: center; line-height: 115%;"><b><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 14pt; mso-bidi-font-size: 11.0pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;"><font color="#000000">울산인재평생교육진흥원   <span lang="EN-US">2021 상</span>반기 장학생 선발 안내</font></span></b></p><p align="center" style="margin: 1em 0px; text-align: center; line-height: 115%;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-bidi-font-size: 10.0pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast;"><font color="#000000">&nbsp;</font></span></b></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><b><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast;">1. </span></b><b><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast;">장학금<span lang="EN-US">: </span>등록금 최대<span lang="EN-US"> 200</span>만원 또는 생활비<span lang="EN-US"> 70</span>만원 </span></b></font></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-bidi-font-size: 10.0pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast;">-   </span><b style="mso-bidi-font-weight: normal;"><u><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-bidi-font-size: 10.0pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast;">장학금  종류 및 지급액은 첨부의 선발 공고문 반드시 참조</span></u></b></font></p><p style="margin: 1em 0px; line-height: 115%;"><b><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast;"><font color="#000000">&nbsp;</font></span></b></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><b><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast;">2. </span></b><b><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast;">지원자격   </span></b></font></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast;">-&nbsp;울산시 소재 고등학교 졸업자로&nbsp;</span><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast;">공고일  현재 본인 또는 보호자 주민등록상 울산 거주</span></font></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><b><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;">- </span></b><b><u><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;">장학금별 지원자격은 첨부의 선발 공고문 반드시 참조</span></u></b><b><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;"> </span></b></font></p><p style="margin: 1em 0px; line-height: 115%;"><b><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;"><font color="#000000">&nbsp;</font></span></b></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><b><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;">3. </span></b><b><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;">지원기간<span lang="EN-US">: 2021</span>년 3월 22일<span lang="EN-US">(</span>월<span lang="EN-US">)~4</span>월 9일<span lang="EN-US">(금</span><span lang="EN-US">)</span></span></b></font></p><p style="margin: 1em 0px; line-height: 115%;"><b><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;"><span style="mso-spacerun: yes;"><font color="#000000">&nbsp;</font></span></span></b></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><b><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;">4. </span></b><b><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;">제출서류</span></b></font></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">- </span><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">장학생 지원 신청서 및 신청인 서약서</span></font></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">- </span><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">개인정보 수집<span lang="EN-US">.</span>이용<span lang="EN-US">.</span>제공 및 조회 동의서</span></font></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">- </span><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">주민등록등본 및 가족관계증명서</span></font></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">- </span><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">등록금 납입 영수증 </span></font></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">- </span><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">재학증명서 및 성적증명서 </span></font></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">- </span><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">본인명의 통장 사본 </span></font></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">- </span><b><u><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;">장학금별 구비서류는 선발 공고문 반드시 참조</span></u></b></font></p><p style="margin: 1em 0px; line-height: 115%;"><b><u><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;"><span style="text-decoration: none;"><font color="#000000"><br></font></span></span></u></b></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><b><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;">5. </span></b><b><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;">접수방법<span lang="EN-US">: 전자신청 후 구비서류와 함께 </span>우편 제출</span></b></font></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕;"><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">- 전자신청: 울산인재평생교육진흥원 홈페이지(<a href="https://www.ulsaninjae.or.kr">https://www.ulsaninjae.or.kr</a>)</span></span></font></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">- 제출</span><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">처<span lang="EN-US">: </span>울산광역시  남구 번영로<span lang="EN-US"> 224 4</span>층 울산인재평생교육진흥원<span lang="EN-US">(</span>우<span lang="EN-US">: 44702)</span></span></font></p><p style="margin: 1em 0px; line-height: 115%;"><font color="#000000"><span lang="EN-US" style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">- </span><span style="line-height: 115%; font-family: &quot;맑은 고딕&quot;; font-size: 11pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 함초롬바탕; mso-bidi-font-weight: bold;">문의전화<span lang="EN-US">:   052-288-7401</span></span></font><br></p>
								</div>

When I tried to Html(data: thatHtml), my console:

======== 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/roeniss/workspace/myapp/lib/views/notice_view.dart:182:29
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)
...
====================================================================================================

It would be great if there are more detailed error log. Or am I missing something?

Actually this is pretty serious because I can't catch it before rendering:

Widget build(BuildContext context){
  	// ... 	  
 	Widget content;
	  ```dart
	try {
		content = Html(data: webContent);
	} catch (e) {
		content = Text('Can't show detail');
	}
  	// ... 

  	return content;
}

Above trycatch doesn't catch the exception.

@erickok
Copy link
Collaborator

erickok commented Mar 4, 2021

Duplicate of #554? What version of flutter_html ar eyou using?

@roeniss
Copy link
Author

roeniss commented Mar 4, 2021

@erickok Maybe, not sure.

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_html: ^1.3.0

and

❯❯ flutter doctor -v
[✓] Flutter (Channel stable, 2.0.0, on Mac OS X 10.15.7 19H15 darwin-x64, locale ko-KR)
    • Flutter version 2.0.0 at /usr/local/Caskroom/flutter/1.22.5/flutter
    • Framework revision 60bd88df91 (23 hours ago), 2021-03-03 09:13:17 -0800
    • Engine revision 40441def69
    • Dart version 2.12.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/roeniss/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/roeniss/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/roeniss/Library/Android/sdk
    • Java binary at: /Users/roeniss/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6626763/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Users/roeniss/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6626763/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.2)
    • IntelliJ at /Users/roeniss/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.53.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • iPhone 6 (mobile) • B482BA5A-747B-4360-B59A-417242E33737 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-10-3 (simulator)
    • Chrome (web)      • chrome                               • web-javascript • Google Chrome 88.0.4324.192

@Mattjevaas
Copy link

i face the same issue after upgrading to flutter 2.0.0, try downgrade your flutter version to previous stable version 1.22.6. It works fine at 1.22.6

@roeniss
Copy link
Author

roeniss commented Mar 4, 2021

@Mattjevaas Can you specify which version to use? I got error :(

Because no versions of flutter_html match >1.3.0 <2.0.0 and flutter_html 1.3.0 depends on flutter_svg ^0.20.0-nullsafety.3, flutter_html ^1.3.0 requires flutter_svg ^0.20.0-nullsafety.3.
Because flutter_svg 0.20.0-nullsafety.3 requires SDK version >=2.12.0-0 <3.0.0 and no versions of flutter_svg match >0.20.0-nullsafety.3 <0.21.0, flutter_svg ^0.20.0-nullsafety.3 is forbidden.
Thus, flutter_html ^1.3.0 is forbidden.

@Mattjevaas
Copy link

Mattjevaas commented Mar 4, 2021

@roeniss change to flutter_html: ^1.2.0 on your pubspec.yaml, then do pub get

here is mine

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_html: ^1.2.0
[✓] Flutter (Channel stable, 1.22.6, on macOS 11.2.1 20D74 darwin-x64, locale en-ID)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 12.4)

@tneotia
Copy link
Collaborator

tneotia commented Mar 4, 2021

Yes this is a duplicate of #554, I just tested on my nullsafety branch and I do not get this error.

If you'd like you can use master in your pubspec or wait for a new version of the package, and this will be fixed.

@roeniss
Copy link
Author

roeniss commented Mar 5, 2021

Ok. now it works. Thank you @Mattjevaas and @tneotia !

BTW I still got two questions....

  1. How did you know there is 1.2.0? I can't find it on here : https://github.com/Sub6Resources/flutter_html/releases

  2. Just curious, why flutter 2.0.0 make such a trouble?

@tneotia
Copy link
Collaborator

tneotia commented Mar 5, 2021

  1. 1.2.0 wasn't tagged in github for some reason but is available from Pub
  2. It isn't a Flutter 2.0.0+ issue, this is an issue in the code for parsing text-decoration. This was a feature in 1.3.0 and is a bug, but it is fixed on master. Since the feature is not there on 1.2.0 and below, everything works fine there also.

@Mattjevaas
Copy link

@tneotia are you sure it fixed? i change my pubspec to master and still got the issue, or am i do wrong here?

here is my html

<div style="text-align: left;">some text</div>
<div style="text-align: left;"><br></div>
<div style="text-align: left;"><span style="font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 1rem;">some text</span></div>
<div style="text-align: left;"><span style="font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 1rem;"><br></span><span style="font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Sy<…>

[✓] Flutter (Channel stable, 2.0.1, on macOS 11.2.1 20D74 darwin-x64, locale en-ID)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Community Edition (version 2019.3.3)
[✓] VS Code (version 1.53.2)
[✓] Connected device (2 available)
environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_html:
    git:
      url: https://github.com/Sub6Resources/flutter_html.git
      ref: master

Note :

  • it works on simpler html
  • i use the same html at 1.2.0 and it works just fine

@Mattjevaas
Copy link

@roeniss actually there is no need to downgrade your flutter version XD, you can use flutter 2.0.+, just change the flutter_html verison to 1.2.0 without ^ to force using 1.2.0.

like this

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_html: 1.2.0

i just tested it, sorry

@tneotia
Copy link
Collaborator

tneotia commented Mar 5, 2021

@Mattjevaas hm can I get your full HTML to try and reproduce this? With @roeniss HTML it works great.

@Mattjevaas
Copy link

@tneotia here is my full HTML

<div style="text-align: left;">Some Text</div>
<div style="text-align: left;"><br></div>
<div style="text-align: left;"><span style="font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 1rem;"> Some Text</span></div>
<div style="text-align: left;"><span style="font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 1rem;"><br></span><span style="font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 1rem;">Some Text.</span></div>
<div style="text-align: left;"><span style="font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 1rem;"><br></span><span style="font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 1rem;">Some Text</span></div>
<div style="text-align: left;"><span style="font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 1rem;"><br></span></div>
<div style="text-align: left;">Some Text</div>

@tneotia
Copy link
Collaborator

tneotia commented Mar 5, 2021

This is different from @roeniss issue, I think the CSS parser is having issues with parsing your font family due to the duplicate quotes ("font-family: "stuff";") as it returns an empty list causing the bad state error. This is pretty easy to fix with a catch so I've included it with the nullsafety PR.

tneotia added a commit to tneotia/flutter_html that referenced this issue Mar 5, 2021
@Mattjevaas
Copy link

Ah thanks @tneotia ! It works now 😄

@tneotia
Copy link
Collaborator

tneotia commented Mar 6, 2021

@erickok this can be closed once 2.0.0 is out.

@erickok
Copy link
Collaborator

erickok commented Mar 6, 2021

Please try 2.0.0-nullsafety.0 which is out now.

@erickok erickok closed this as completed Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants