swagger-api / swagger-api/swagger-codegen

Flutter not building - seems like codegen doesn't support Dart 2.1

Open
#9,422 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Trying to build code generated by codegen for Dart/Flutter project and getting the following error:

The current Dart SDK version is 2.1.2-dev.0.0.flutter-0a7dcf17eb.
Because MeBa depends on swagger from path which requires SDK version <2.0.0, version solving failed.
pub get failed (1)

Swagger-codegen version

2.4.5 (latest as of 3-Feb-2019)

Swagger declaration file content or url

My Flutter pubspec:
YAML:
name: MeBa
description: My First Flutter project
version: 1.0.0+1

environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"

dependencies:
flutter:
sdk: flutter

cupertino_icons: ^0.1.2

english_words: ^3.1.0
http: ^0.12.0+1
google_sign_in: ^4.0.1+1
firebase_auth: ^0.7.0
cloud_firestore:
date_format: ^1.0.6
font_awesome_flutter: ^8.4.0
flutter_datetime_picker: ^1.1.3
shared_preferences: ^0.5.1+2
json_annotation: ^2.2.0
build_runner: ^1.2.0
swagger:
path: ./swagger

dev_dependencies:
json_serializable: ^2.1.2
flutter_test:
sdk: flutter

flutter:
uses-material-design: true

assets:
- assets/env/dev.json

Command line used for generation

flutter packages get build

Steps to reproduce

Copy files generated by codegen (I used the run-in-docker command) to the project root directory, under "swagger". Link to it under dependencies/swagger, and run build.

Related issues/PRs
Suggest a fix/enhancement

I am trying to understand where the Dart limitation, to be <2 is defined. I checked the one dependency Swagger has, http, and it looks up to date.

Thanks in advance.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure using the Flutter pubspec shown in the issue, the generated files under the swagger path dependency, and the flutter packages get build command. Start by inspecting the generated Dart package metadata and its SDK constraint; done means the generated project resolves successfully with the reported Dart 2.1 Flutter SDK.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.