Is it possible for a Chrome Extension to Add/Remove Widgets at Runtime in a Flutter Web App?

423

Short answer: no. Long answer: with a lot of time and work it's possible, but is probably not worth doing and shouldn't be considered a feasible use case.

For a typical html/css/js app, web extensions using js can easily simply modify the html and css of the web page, instantly removing elements.

For a Flutter Web application, all of the dart code is compiled to js, and this is used to draw to a single HTML element on the page. So the js file must be modified as opposed to the html or css.

The fact that the dart code is compiled to js, means that it should technically still be able to be modified on the client side with a Chrome extension. The Chrome extension could perhaps use chrome.scripting to copy and inject a modifed js file or chrome.declarativeWebRequest to replace the downloaded js file with the modified one.

Finding which js to modify might be difficult, but if the source map is available it could be easier.

Modding a Flutter Application with a Chrome extension is somewhere inbetween:

  • modding a video game to include an extra menu or some helpful UI or modified assets or character behaviour in game (although without memory injection as opposed to modifying a unity web app or unity or unreal in general)
  • using a web extension to modify a typical web app.

Overall, modifying a Flutter Web App by using a Chrome Extension (or any means really other than working with the developers of the web app) would be quite difficult and may not be worth the effort.

Share:
423
heliam1
Author by

heliam1

Updated on December 29, 2022

Comments

  • heliam1
    heliam1 over 1 year

    This is different to creating a Flutter UI using a Chrome Extension. That is indeed possible and able to confirmed on the first page of search engine results.

    I am wondering whether a Chrome Extension could modify a website built with Flutter for the following use case:

    This Flutter Web App has a newsfeed, and I wish to write a Chrome Extension which would to remove elements/widgets which contain text/keywords that I am not interested in seeing.

    Basically is it possible for a Chrome Extension to Add/Remove Widgets discriminating by text at Runtime in a Flutter Web App?