title: Flutter Web - Unsupported operation: NaN error for canvas in Card widget
body: <p>I am working on a flutter web project. We use the library <a href="https://pub.dev/packages/fl_chart" rel="nofollow noreferrer">fl_chart</a>. We would like to use a <code>PieChart</code> in a <code>Card</code> widget but it throws the error <code>Unsupported operation: NaN</code>. It happens in debug and release mode (launched from the command lines <code>flutter run lib/main.dart</code> and <code>flutter run --release lib/main.dart</code>) but it doesn't happen when the application is launched through the VSCode debugger.</p>
  <p>Here is a small example (<code>main.dart</code>):</p>
  <pre class="lang-dart prettyprint-override"><code>import 'package:fl_chart/fl_chart.dart';
  import 'package:flutter/material.dart';
  
  class PieChartTest extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: Scaffold(
          body: Card(    // &lt;- If you change it to a Container, it is working fine
            child: PieChart(
              PieChartData(
                sections: [
                  PieChartSectionData(
                    value: 4.0,
                    title: 'Section 1',
                    color: Colors.blue,
                  ),
                  PieChartSectionData(
                    value: 6.0,
                    title: 'Section 2',
                    color: Colors.red,
                  ),
                ],
              ),
            ),
          ),
        ),
      );
    }
  }
  
  Future&lt;void&gt; main() async {
    runApp(PieChartTest());
  }
  </code></pre>
  <p>Here are the logs</p>
  <pre><code>══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY
  ╞═════════════════════════════════════════════════════════
  The following UnsupportedError was thrown during a scheduler callback:
  Unsupported operation: NaN
  
  When the exception was thrown, this was the stack:
  dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 216:49  throw_
  dart-sdk/lib/_internal/js_dev_runtime/private/js_number.dart 80:5             toInt]
  dart-sdk/lib/_internal/js_dev_runtime/private/js_number.dart 87:32            ceil]
  lib/_engine/engine/bitmap_canvas.dart 176:52
  _widthToPhysical
  lib/_engine/engine/bitmap_canvas.dart 120:32                                  new
  lib/_engine/engine/html/picture.dart 518:33
  [_findOrCreateCanvas]
  lib/_engine/engine/html/picture.dart 433:21
  paintCallback
  lib/_engine/engine/html/surface.dart 49:16
  commitScene
  lib/_engine/engine/html/scene_builder.dart 552:7                              &lt;fn&gt;
  lib/_engine/engine/profiler.dart 36:18
  timeAction
  lib/_engine/engine/html/scene_builder.dart 546:12                             build
  packages/flutter/src/rendering/layer.dart 770:35
  buildScene
  packages/flutter/src/rendering/view.dart 231:30
  compositeFrame
  packages/flutter/src/rendering/binding.dart 458:18                            drawFrame
  packages/flutter/src/widgets/binding.dart 900:13                              drawFrame
  packages/flutter/src/rendering/binding.dart 320:5
  [_handlePersistentFrameCallback]
  packages/flutter/src/scheduler/binding.dart 1119:15
  [_invokeFrameCallback]
  packages/flutter/src/scheduler/binding.dart 1057:9
  handleDrawFrame
  packages/flutter/src/scheduler/binding.dart 865:7                             &lt;fn&gt;
  dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:19
  internalCallback
  ═══════════════════════════════════════════════════════════════════════════════════════
  ═════════════
  Another exception was thrown: Unsupported operation: NaN
  
  </code></pre>
  <p>I'm using the Flutter 1.25.0-8.1.pre beta</p>
  <hr />
  <p>What is it happening and why ?</p>
  <p>And also how can I fix this or is there any work around ?</p>
  <hr />
  <p>EDIT:</p>
  <p>It also doesn't work with Flutter <code>1.25.0-8.3.pre • channel beta</code> and hits the same issue.
  It works on Flutter <code>1.26.0-17.1.pre • channel dev </code>.</p>
  <p>But the project we use needs the beta channel.</p>
  <p>It works using the option <code>--web-renderer canvaskit</code> but I would like to continue to use the <code>html</code> one.</p>