I've found that Dart support for swagger-codegen has suffered bitrot. The output doesn't work with modern projects as its not null-safe.
I was about to work on a patch. However, I don't know if null-safety more or less mandatory now. Should code generators need to support both null-safe and non-null-safe dart as separate language variants?
Yes, sound null safety is now mandatory from Dart 3.
From Sound null safety on Dart's website, it says:
Dart 3 has built-in sound null safety. Dart 3 prevents code without it from running.