简体   繁体   中英

How to add a swagger dependency in pubspec.yaml of flutter

I'm a new developers with flutter, and i want to use "swagger" in my application. I add the dependencies of swagger in pubspec.yaml, but there's always an error.

pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^0.1.2
  english_words: ^3.1.0
  swagger: ^1.0.0

when i clicked Packages get, this is the following output:

Running "flutter packages get" in my_first_app...               
Because my_first_app depends on swagger ^1.0.0 which doesn't match any versions, version solving failed.

pub get failed (1)
Process finished with exit code 1

How can i use swagger in my Flutter application?

You probably should use instead

open_api: ^2.0.1

swagger is deprecated and not compatible with Dart 2 and the requested version 1.0.0 doesn't exist at all.

From https://pub.dartlang.org/packages/swagger#-readme-tab-

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM