Pen Settings


Babel is required to process package imports. If you need a different preprocessor remove all packages first.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                import 'dart:async';
import 'dart:ui';

import 'package:flutter/material.dart';

/// path

void main() {
    home: Scaffold(body: Board()),
    debugShowCheckedModeBanner: false,

final size = window.physicalSize / window.devicePixelRatio;

class Board extends StatefulWidget {
  _BoardState createState() => _BoardState();

class _BoardState extends State<Board> {
  final List<Offset> _points = [];

  // ignore: close_sinks
  final StreamController<List<Offset>> _streamer =

  Stream<List<Offset>> get point$ =>;

  Widget build(BuildContext context) => MouseRegion(
        onHover: (details) => _streamer.add(_points..add(details.position)),
        child: StreamBuilder<List<Offset>>(
          initialData: _points,
          stream: point$,
          builder: (context, snapshot) =>
              CustomPaint(size: size, painter: Painter(,

  void dispose() {

class Painter extends CustomPainter {
  static const radius = 2.0;

  static final fill = Paint()..color =;

  static final stroke = Paint()
    ..color = Colors.grey = PaintingStyle.stroke;

  final List<Offset> points;

  const Painter(this.points);

  void paint(Canvas canvas, Size size) {
    if (points.isEmpty) return;
    for (final point in points) canvas.drawCircle(point, radius, fill);

    for (int i = 0; i < points.length - 1; i++) {
      canvas.drawLine(points[i], points[i + 1], stroke);

  bool shouldRepaint(Painter oldDelegate) =>