Professional Documents
Culture Documents
Flutter Web Declarative Bootstrap (PUBLICLY SHARED) 3
Flutter Web Declarative Bootstrap (PUBLICLY SHARED) 3
Unset Unset
<html> <html>
<head> <head>
<script src="flutter.js" defer></script> <script src="flutter.js" defer></script>
</head> </head>
<body> <body>
<!-- website markup --> <flutter-app option="value">
<div id="view_1"></div> <!-- website markup -->
<!-- website markup --> <flutter-view id="view_1"></flutter-view>
<script> <!-- website markup -->
window.addEventListener("load", </flutter-app>
function(_) { </body>
_flutter.loader.loadEntrypoint({ </html>
option: 'value',
});
});
</script>
</body>
</html>
The proposed approach leverages Custom Elements, which are a part of the Web
Components API.
In a nutshell: one can define a <custom-app> element that can contain any markup
(like <div>s do), but which exposes a special setColor method that can be called
on an instance of the custom element obtained with querySelector (or any other
DOM selection method).
● https://jsfiddle.net/ditman/wzqban5u
PUBLICLY SHARED