adapt to latest Dart version.
fix canvas handling.