swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.91k stars 6.03k forks source link

[Dart] deprecated dart 2 code generated #8353

Open judithgull opened 6 years ago

judithgull commented 6 years ago
Description

The generated dart code contains deprecations in dart 2. It should be possible to generate code without deprecation warnings. Generating valid dart 1 code should be possible as well.

Swagger-codegen version

2.4.0

Swagger declaration file content or url

http://petstore.swagger.io/v2/swagger.json

Command line used for generation

./bin/dart-petstore.sh

Steps to reproduce
Flutter Version

Flutter 0.5.1 • channel beta • https://github.com/flutter/flutter.git Framework • revision c7ea3ca377 (4 weeks ago) • 2018-05-29 21:07:33 +0200 Engine • revision 1ed25ca7b7 Tools • Dart 2.0.0-dev.58.0.flutter-f981f09760

Suggest a fix/enhancement

I suggest to add a new option for the dart version and generate code accordingly.

jaumard commented 6 years ago

Now JSON is more than deprecated, it doesn't find this class at all for me. Same for the BASE64 and UTF8 classes...