dart-course
dart-course copied to clipboard
operators.dart error "NoSuchMethodError: The method 'call' was called on null."
This code fails when run in VScode as well as with the official Dart 2.14 and 2.18 docker images (the only ones I tried).
Specifically, this block throws the error:
var paint = Paint() // Throws "NoSuchMethodError: The method 'call' was called on null."
..color = 'black'
..strokeCap = 'round'
..strokeWidth = 5.0;
Repro with official dart docker image:
docker run -i dart:2.14 bash -c 'curl -fsLO https://raw.githubusercontent.com/fireship-io/dart-course/main/bin/operators.dart && dart operators.dart'
Unhandled exception:
NoSuchMethodError: The method 'call' was called on null.
Receiver: null
Tried calling: call()
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:63:5)
#1 main (file:///root/operators.dart:32:20)
#2 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:283:19)
#3 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)