Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update HTML meta tags inside index.html dynamically in Flutter Web

I have created a website in Flutter web and added all meta tags inside index.html for SEO. The title tags get updated using the Flutter Title widget but I want to update description, keywords, og:title, og:description etc HTML tags for SEO when the webpage changes. How can I do this?

like image 752
Rashmi Tank Avatar asked Feb 28 '26 22:02

Rashmi Tank


1 Answers

to append meta in header try this in main and before runApp

  html.MetaElement meta = html.MetaElement();
  meta.content = "meta-content";
  meta.name = "meta-name";
  html.document.head?.append(meta);

and don't forget to add to pubspec.yaml file in dependencies

http: ^0.13.4

and finally inspect your page to see it , it will be found before closing tag of header , also you can append any script or element to head or body tag

like image 167
Sherif farid Avatar answered Mar 03 '26 10:03

Sherif farid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!