dart 'flutter_web_plugins from sdk doesn't exist'错误

wnavrhmk  于 2023-09-28  发布在  Flutter
关注(0)|答案(1)|浏览(116)

我试图在Flutter中添加一个视频到页面,并得到以下错误:

'Because video_player >=2.0.0 depends on video_player_web ^2.0.0 which depends on flutter_web_plugins from sdk, video_player >=2.0.0 requires flutter_web_plugins from sdk.

因此,由于sdk中的flutter_web_plugins不存在(在Flutter SDK中找不到flutter_web_plugins包),并且longcovidbase依赖于video_player ^2.2.12,版本解析失败。
我已经将这些导入到主.dart文件中

'import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:video_player/video_player.dart';
import 'package:flutter_svg/flutter_svg.dart';'

这是我的pubspec.yaml:

name: longcovidbase
description: For long covid sufferers.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: '>=3.1.0 <4.0.0'

dependencies:
  video_player: 2.7.1
  flutter_svg:
  google_fonts:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0
  video_player: ^2.2.12

flutter:
  plugin:
    platforms:
      web: null # Exclude web support
  uses-material-design: true
  assets:
    - assets/images/

有人知道怎么解决这个问题吗?

nxowjjhe

nxowjjhe1#

我也有同样的错误,我通过更新Flutter解决了它。起初它不让我用基本命令更新它,所以我强制它。

flutter upgrade --force

相关问题