How to load a HTML in String to WebView in Flutter

Issue

I have some HTML code which is in String variable, not in a file. I want to load this String-HTML on WebView

Solution

use this package flutter_html: ^1.0.0

import 'package:flutter_html/flutter_html.dart';

SingleChildScrollView(
       child: Html(
               data: "<div></div>", // Your Html code over here
                padding: EdgeInsets.all(8.0),
              ));

Answered By – Bhargav Sejpal

Answer Checked By – Gilberto Lyons (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *