Blinking during of rendering pages with custom elements (FOUC issue)


I use dart-polymer package to create custom elements. I have noticed that there is some blinking during of page with the custom elements loading. This effect also is visible for the very simple ClickCounter app. Is there any way to avoid this vexing blinking?

The issue is good described in Wikipedia

The suggested solution from does not work for the simple application (polymer: ‘0.10.0-pre.2’)..

    <title>Click Counter</title>

    <!-- import the click-counter -->
    <link rel="import" href="packages/polymer/polymer.html">
    <link rel="import" href="clickcounter.html">
    <script type="application/dart">export 'package:polymer/init.dart';</script>
    <script src="packages/browser/dart.js"></script>
    <body unresolved>

    <p>Hello world from Dart!</p>

    <div id="sample_container_id">
      <click-counter count="5"></click-counter>

<polymer-element name="click-counter" attributes="count">
      div {
        font-size: 24pt;
        text-align: center;
        margin-top: 140px;
      button {
        font-size: 24pt;
        margin-bottom: 20px;
      <button on-click="{{increment}}">Click me</button><br>
      <span>(click count: {{count}})</span>
  <script type="application/dart" src="clickcounter.dart"></script>
import 'package:polymer/polymer.dart';

 * A Polymer click counter element.
class ClickCounter extends PolymerElement {
  @published int count = 0;

  ClickCounter.created() : super.created() {

  void increment() {

see also the created issue in


Polymer 0.9.5
The class names to use are polymer-veiled (hidden) and polymer-unveil (during unveil transition)
If it is different than in Polymer.js it is probably subject of change but as of PolymerDart 0.9.0 it should work.

The relevant code is in packages/polymer/src/boot.dart.

Polymer 0.10.0
Polymer 0.10.0-pre.1 uses already the unresolved attribute like explained here
Polymer – Styling reference – FOUC prevention

You need to add a version constraint in pubspec.yaml to get the development version like
polymer: ">=0.10.0-pre.1"

Answered By – Günter Zöchbauer

Answer Checked By – David Marino (FlutterFixes Volunteer)

Leave a Reply

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