import 'dart:core'; import 'package:collection/collection.dart'; class Grid extends DelegatingList { final List _internal; final width; final height; Grid(int width, int height) : this._(List(width * height), width, height); Grid.from(Grid l) : this._(List.from(l.getRange(0, l.length)), l.width, l.height); Grid.fromList(List l, int width) : this._(l, width, l.length ~/ width); Grid._(l, int w, int h) : _internal = l, width = w, height = h, super(l); }