Flutter中 ‘package:socket_io/socket_io.dart’ 库不存在。

huangapple go评论87阅读模式
英文:

Flutter 'package:socket_io/socket_io.dart' library doesn't exist

问题

我尝试添加Flutter包socket.io,但它不存在。我尝试添加package:socket_io_client/socket_io_client.dart和package:socket_io/socket_io.dart' as IO;库,但出现了问题。导入'dart:async';
导入'package:flutter/material.dart';这两个库没有问题。我该如何解决这个问题?

英文:

Flutter中 ‘package:socket_io/socket_io.dart’ 库不存在。

I tried add the flutter package socket.io but it doesn't exist. I tried add package:socket_io_client/socket_io_client.dart and package:socket_io/socket_io.dart' as IO; libraries but I have a problem. import 'dart:async';
import 'package:flutter/material.dart'; No problems these last two libraries. How can i solve this problem?

答案1

得分: 1

在你可以导入该包之前,你必须将它添加到pub。尝试以下命令

flutter pub add socket_io_client

这将导致你的pubspec.yaml文件更新。然后,你可以运行flutter pub get来更新项目中的依赖项。

英文:

Before you can import the package, you must add it to pub. Try the command

flutter pub add socket_io_client

This will cause your pubspec.yaml file to update. Then, you can run flutter pub get to update the dependencies across your project.

huangapple
  • 本文由 发表于 2023年7月12日 21:40:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/76671236.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定