我是一位扑朔迷离的新开发人员,我想在我的应用程序中使用“ swagger”。我在pubspec.yaml中添加了swagger的依赖项,但是总是有错误。
pubspec.yaml:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
english_words: ^3.1.0
swagger: ^1.0.0
当我单击Packages get时,这是以下输出:
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
如何在Flutter应用程序中使用摇摇欲坠?
答案 0 :(得分:1)
您可能应该改用
switch (method){
case "ping": {
try{
data = URLEncoder.encode("type", "UTF-8") + "=" + URLEncoder.encode("ping", "UTF-8");
Log.e(TAG,"DATA: " + data);
}catch (UnsupportedEncodingException e){
Log.e(TAG, "UnsupportedEncodingException: " + e.toString());
}
try {
URL url = new URL(link);
HttpURLConnection h = (HttpURLConnection) url.openConnection();
h.setDoInput(true);
h.setDoOutput(true);
OutputStreamWriter owriter =
new OutputStreamWriter(h.getOutputStream());
owriter.write(data);
owriter.flush();
BufferedReader b = new BufferedReader
(new InputStreamReader(h.getInputStream(), "UTF-8"), 8);
StringBuilder builder = new StringBuilder();
String line;
while ((line = b.readLine()) != null) {
builder.append(line);
}
return builder.toString();
} catch (IOException e) {
Log.e(TAG, "IOException: " + e.toString());
}
}
break;
case "updatecounter": {
open_api: ^2.0.1
已过时,并且与Dart 2不兼容,并且所请求的版本swagger
根本不存在。