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

Getting '<Unexpected Null Value>' using with Flutter Web #300

Closed
jlubeck opened this issue May 22, 2020 · 13 comments
Closed

Getting '<Unexpected Null Value>' using with Flutter Web #300

jlubeck opened this issue May 22, 2020 · 13 comments
Labels
bug Something isn't working

Comments

@jlubeck
Copy link

jlubeck commented May 22, 2020

Just by using this simple script:

import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';

class TestScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Html(
        data: '<p>Test</p>',
      ),
    );
  }
}

And trying it on web I get the following error:

══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following NoSuchMethodError was thrown during performLayout():
'<Unexpected Null Value>'
method not found
Receiver: null
Arguments: []

The relevant error-causing widget was:
  Text
  file:///Users/jan/.pub-cache/hosted/pub.dartlang.org/flutter_html-1.0.0/lib/html_parser.dart:719:19

When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 216:49      throw_
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 58:3        throwNullValueError
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 488:39  _notNull
packages/flutter/src/widgets/widget_span.dart 108:37                              build
packages/flutter/src/painting/text_span.dart 211:14                               build
packages/flutter/src/painting/text_span.dart 211:14                               build
packages/flutter/src/painting/text_painter.dart 558:13                            layout
packages/flutter/src/rendering/paragraph.dart 490:18                              [_layoutText]
packages/flutter/src/rendering/paragraph.dart 513:5                               [_layoutTextWithConstraints]
packages/flutter/src/rendering/paragraph.dart 581:5                               performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 266:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/shifted_box.dart 394:13                            performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/shifted_box.dart 207:11                            performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/paragraph.dart 530:12                              [_layoutChildren]
packages/flutter/src/rendering/paragraph.dart 580:5                               performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 266:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/shifted_box.dart 394:13                            performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/paragraph.dart 530:12                              [_layoutChildren]
packages/flutter/src/rendering/paragraph.dart 580:5                               performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 266:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 266:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/custom_layout.dart 171:10                          layoutChild
packages/flutter/src/material/scaffold.dart 480:7                                 performLayout
packages/flutter/src/rendering/custom_layout.dart 240:7                           [_callPerformLayout]
packages/flutter/src/rendering/custom_layout.dart 399:14                          performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/proxy_box.dart 1265:11                             performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/proxy_box.dart 3242:13                             performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/widgets/overlay.dart 700:14                                  performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/proxy_box.dart 111:13                              performLayout
packages/flutter/src/rendering/object.dart 1767:7                                 layout
packages/flutter/src/rendering/view.dart 167:48                                   performLayout
packages/flutter/src/rendering/object.dart 1630:7                                 [_layoutWithoutResize]
packages/flutter/src/rendering/object.dart 887:17                                 flushLayout
packages/flutter/src/rendering/binding.dart 402:19                                drawFrame
packages/flutter/src/widgets/binding.dart 865:13                                  drawFrame
packages/flutter/src/rendering/binding.dart 284:5                                 [_handlePersistentFrameCallback]
packages/flutter/src/scheduler/binding.dart 1074:15                               [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1013:9                                handleDrawFrame
packages/flutter/src/scheduler/binding.dart 822:7                                 <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 50:19           internalCallback

The following RenderObject was being processed when the exception was fired: RenderParagraph#ab787 relayoutBoundary=up12 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
  creator: RichText ← Text ← SizedBox ← StyledText ← Align ← DecoratedBox ← Padding ← Container ←
    ContainerSpan ← RichText ← Text ← SizedBox ← ⋯
  parentData: <none> (can use size)
  constraints: BoxConstraints(w=1645.0, 0.0<=h<=Infinity)
  size: MISSING
  textAlign: start
  textDirection: ltr
  softWrap: wrapping at box width
  overflow: clip
  locale: en_US
  maxLines: unlimited
This RenderObject had the following descendants (showing up to depth 5):
    text: TextSpan
      TextSpan
        WidgetSpan#ec776
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: Assertion failed: file:///Users/jan/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
Another exception was thrown: Assertion failed: file:///Users/jan/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
Another exception was thrown: Assertion failed: file:///Users/jan/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
Another exception was thrown: Assertion failed: file:///Users/jan/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
Another exception was thrown: Assertion failed: file:///Users/jan/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
Another exception was thrown: Assertion failed: file:///Users/jan/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
Another exception was thrown: Assertion failed: file:///Users/jan/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
Another exception was thrown: Assertion failed: file:///Users/jan/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
Another exception was thrown: Assertion failed: file:///Users/jan/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
Another exception was thrown: Assertion failed: file:///Users/jan/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
Another exception was thrown: Assertion failed: file:///Users/jan/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
Another exception was thrown: Assertion failed: file:///Users/jan/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
Another exception was thrown: NoSuchMethodError: '<Unexpected Null Value>'

This is my flutter doctor

[✓] Flutter (Channel beta, 1.18.0-11.1.pre, on Mac OS X 10.15.4 19E287, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.6)
[!] VS Code (version 1.45.1)
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available)
@datayeah
Copy link

Did you solve this somehow? Stuck at the same after upgrading to 1.0.0.

@JaviBonilla
Copy link

Any update on this?

@Swapnilgshah
Copy link

I am getting the same issue in 1.0.0 Flutter Web

@RyanSusana
Copy link

I can also confirm this issue

@ryan-berger
Copy link
Collaborator

I'll take a look at this sometime this week as it looks critical. From what I understand, we don't officially Web, but if this is the only thing holding us from fully supporting Flutter Web, I don't mind supporting it

@RyanSusana
Copy link

I can confirm that 0.11 does work on the web

@strifel
Copy link

strifel commented Jun 8, 2020

After upgrading to 1.0.0 because to use tags web does not work anymore

@Swapnilgshah
Copy link

I am getting the same issue in 1.0.0 Flutter Web
But works with flutter_html: ^0.9.6

@NicolasDionB
Copy link

NicolasDionB commented Jun 10, 2020

I get a similar error but with IntrinsicHeight after I upgraded to 1.0.0, with Flutter SDK 1.17.3:

════════ Exception caught by rendering library ═════════════════════════════════
The following NoSuchMethodError was thrown during performLayout():
'<Unexpected Null Value>'
method not found
Receiver: null
Arguments: []

The relevant error-causing widget was
    Html
lib\…\chat\panel_chat_entry.dart:114
When the exception was thrown, this was the stack
...

I can also confirm it was working before with version 0.11.0 still with Flutter SDK 1.17.3.

@ryan-berger ryan-berger added the bug Something isn't working label Jun 11, 2020
@ryan-berger
Copy link
Collaborator

I'm having a hard time getting my build process working and I don't have too much time this weekend and have other issues that need my attention. If anyone can submit a PR to fix this it would me much appreciated and I would make it a priority to get it merged.

One thing I did notice is that the line it is complaining about is the line that holds a Text.rich constructor, so maybe there is something being deprecated within the Text class in the newer versions of Flutter, or maybe there is a slight API change. It is possible this could be a Flutter issue.

@OlegBrony
Copy link

+1. I get this error (or it looks like the same) in all cases. here is the stack trace:
https://gist.github.com/OlegBrony/eb153dcc604c26e02a1cb8c20908aeef

I got code from package example:

const htmlData = """
<div>qweqwe</div>
""";

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: AppBar(
        title: Text('flutter_html Example'),
        centerTitle: true,
      ),
      body: SingleChildScrollView(
        child: Html(
          data: htmlData,
          //Optional parameters:
        ),
      ),
    );
  }
}

@erickok
Copy link
Collaborator

erickok commented Feb 8, 2021

Duplicate of #91

@erickok erickok marked this as a duplicate of #91 Feb 8, 2021
@erickok erickok closed this as completed Feb 8, 2021
@tneotia
Copy link
Collaborator

tneotia commented Feb 24, 2021

I don't get this issue on web:

image

Flutter doctor
[√] Flutter (Channel beta, 1.26.0-17.6.pre, on Microsoft Windows [Version 10.0.19042.844], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[√] Android Studio (version 4.1.0)
[√] VS Code (version 1.52.1)
[√] Connected device (2 available)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests