How can i get web site title in flutter?


I want to get the title of a given website address in flutter. Example a website title : <title>Some Value</title>. How can i get Some Value in title tag?


Use the html package so that you can parse the HTML content of the website. Then you can use querySelector('title')!.text to get the text of the <title> element.

import 'package:html/parser.dart' as html_parser;

void main() {
    const html = '<title>Some Value</title>';
    var doc = html_parser.parse(html);
    final value = doc.querySelector('title');

Answered By – Young A

Answer Checked By – Cary Denson (FlutterFixes Admin)

Leave a Reply

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