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

On using MarkdownStyleSheet: The method 'merge' was called on null #105

Open
singh-preet opened this issue Apr 10, 2020 · 1 comment
Open

Comments

@singh-preet
Copy link

singh-preet commented Apr 10, 2020

Hello, thanks in advance. I am using flutter_html_view plugin to read display blogs. I am getting html data from wordpress api. I am getting 12-13 blogs from the API. All of them are working, except one.
When I open that blog, it says "The method 'merge' was called on null ".
However, if I remove the stylesheet, I no longer get any error. Below is my code. Please check and help:
`class BlogDetails extends StatefulWidget {
Map data={};
BlogDetails({this.data});
@OverRide
_BlogDetailsState createState() => _BlogDetailsState();
}

class _BlogDetailsState extends State {
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.data['title']['rendered']),
),
body:
Padding(
padding: const EdgeInsets.all(8.0),
child: HtmlView(
data: widget.data['content']['rendered'],
styleSheet: MarkdownStyleSheet(
p: TextStyle(fontSize: 18, color: Colors.black, fontWeight: FontWeight.w300),
h1: TextStyle(fontSize: 25, color: Colors.black, letterSpacing: 3),
a: TextStyle(color: Colors.blue),
strong: TextStyle(fontWeight: FontWeight.w400),
blockSpacing: 15,
listIndent: 5,
),
onLaunchFail: ()=>print('Waheguru'),
),
)
);
}
}`

@parth22
Copy link

parth22 commented Jun 25, 2020

Hello, I am using this same plugin and i'm also getting this same error in dependancy example. Below is my IDE error log.

I/flutter (12893): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (12893): The following NoSuchMethodError was thrown building HtmlView:
I/flutter (12893): The method 'merge' was called on null.
I/flutter (12893): Receiver: null
I/flutter (12893): Tried calling: merge(null)
I/flutter (12893): 
I/flutter (12893): The relevant error-causing widget was:
I/flutter (12893):   HtmlView file:///Users/inblinfotech/Downloads/FlutterHtmlView-master/example/lib/main.dart:51:22
I/flutter (12893): 
I/flutter (12893): When the exception was thrown, this was the stack:
I/flutter (12893): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
I/flutter (12893): #1      MarkdownBuilder.visitElementBefore (package:flutter_markdown/src/builder.dart:156:28)
I/flutter (12893): #2      Element.accept (package:markdown/src/ast.dart:46:17)
I/flutter (12893): #3      Element.accept (package:markdown/src/ast.dart:49:17)
I/flutter (12893): #4      MarkdownBuilder.build (package:flutter_markdown/src/builder.dart:117:12)
I/flutter (12893): #5      _MarkdownWidgetState._parseMarkdown (package:flutter_markdown/src/widget.dart:117:25)
I/flutter (12893): #6      _MarkdownWidgetState.didChangeDependencies (package:flutter_markdown/src/widget.dart:86:5)
I/flutter (12893): #7      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4661:12)
I/flutter (12893): #8      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
I/flutter (12893): ...     Normal element mounting (31 frames)
I/flutter (12893): #39     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
I/flutter (12893): #40     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5947:32)
I/flutter (12893): ...     Normal element mounting (185 frames)
I/flutter (12893): #225    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
I/flutter (12893): #226    MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5947:32)
I/flutter (12893): ...     Normal element mounting (255 frames)
I/flutter (12893): #481    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
I/flutter (12893): #482    Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
I/flutter (12893): #483    RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1148:16)
I/flutter (12893): #484    RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1119:5)
I/flutter (12893): #485    RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:1061:17)
I/flutter (12893): #486    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2607:19)
I/flutter (12893): #487    RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1060:13)
I/flutter (12893): #488    WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:941:7)
I/flutter (12893): #489    WidgetsBinding.scheduleAttachRootWidget.<anonymous closure> (package:flutter/src/widgets/binding.dart:922:7)
I/flutter (12893): (elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
I/flutter (12893): 
I/flutter (12893): ════════════════════════════════════════════════════════════════════════════════════════════════════

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

2 participants