Because the build runs on the VM, you can't import flutter, so you can't check if things are subtypes of known flutter types. A possibly solution could be a VM compatible version of flutter, but that seems like a very large hammer to use.