This problem was caused by adding fl_chart v 0.40.0 to my pubspec.yaml on my Flutter project.
Version v 0.40.0 of fl_chart introduced breaking changes. A temporary solution was to downgrade to version v 0.36.4. It worked but still looking into why v 0.40.0 throws that error