I'm trying to use the audio player example provided in the package audioplayers 5.2.1

But the audioplayers_example import are not resolved with the following message :

The imported package 'audioplayers_example' isn't a dependency of the importing package.
Try adding a dependency for 'audioplayers_example' in the 'pubspec.yaml' file.
  • 1 : I have created a new project using standard method :
$ flutter create audio_player
  • 2 : I have added the audioplayers dependency into my pubspec.yaml
dependencies:
  flutter:
    sdk: flutter
  audioplayers: ^5.2.1
  • 3 : I've copied the following example into my lib/main.dart :
import 'dart:async';

import 'package:audioplayers/audioplayers.dart';
import 'package:audioplayers_example/components/tabs.dart';
import 'package:audioplayers_example/components/tgl.dart';
import 'package:audioplayers_example/tabs/audio_context.dart';
import 'package:audioplayers_example/tabs/controls.dart';
import 'package:audioplayers_example/tabs/logger.dart';
import 'package:audioplayers_example/tabs/sources.dart';
import 'package:audioplayers_example/tabs/streams.dart';
import 'package:audioplayers_example/utils.dart';
import 'package:flutter/material.dart';

...

Error messages in VS code

I don't know how to resolve the audioplayers_example missing package !

I tried to add it using flutter pub add but I have the following message :

$ flutter pub add audioplayers_example
Because audio_player depends on audioplayers_example any which doesn't exist (could not find package audioplayers_example at https://pub.dev), **version solving failed**.

Any help ?

0

There are 0 answers