audioplayers icon indicating copy to clipboard operation
audioplayers copied to clipboard

correcting name of existing getter error

Open boomx00 opened this issue 2 years ago • 6 comments

just tried to use the latest audioplayer 1.0.0 , get dependencies was fine but when i tried to run my app this message appeared, is this a bug?

`/D:/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers_platform_interface-1.0.0/lib/api/audio_context_config.dart:242:28: Error: The getter 'name' isn't defined for the class 'AVAudioSessionCategory'.

  • 'AVAudioSessionCategory' is from 'package:audioplayers_platform_interface/api/audio_context_config.dart' ('/D:/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers_platform_interface-1.0.0/lib/api/audio_context_config.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'name'. 'category': category.name, ^^^^ /D:/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers_platform_interface-1.0.0/lib/api/audio_context_config.dart:243:39: Error: The getter 'name' isn't defined for the class 'AVAudioSessionOptions'.
  • 'AVAudioSessionOptions' is from 'package:audioplayers_platform_interface/api/audio_context_config.dart' ('/D:/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers_platform_interface-1.0.0/lib/api/audio_context_config.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'name'. 'options': options.map((e) => e.name).toList(),`

boomx00 avatar Jun 14 '22 11:06 boomx00

same question

Irving-Xu avatar Jun 15 '22 05:06 Irving-Xu

Did you try flutter clean? Does the example work for you? Do you have an example project? Also use the issue template!

Gustl22 avatar Jun 25 '22 13:06 Gustl22

Did you try flutter clean? Does the example work for you? Do you have an example project? Also use the issue template!

I tried but still fail.

ruoyifan avatar Jul 01 '22 03:07 ruoyifan

I thought it was because AVAudioSessionCategory is an enum. The enum doesn't support a name getter until a certain dart version? @Gustl22 My Dart version is 2.14.4

ruoyifan avatar Jul 01 '22 04:07 ruoyifan

Again, does the example work? We certainly don't have the time to debug someone elses code. If the example works, try to find the differences and update your code accordingly.

Gustl22 avatar Jul 01 '22 07:07 Gustl22

I met the same issue, Is there anyone solved it?

liang-notes avatar Jul 23 '22 11:07 liang-notes

I have the same issue. Any solution? @liang-notes?

jobypthomas avatar Aug 30 '22 17:08 jobypthomas

@ruoyifan I think you're right. Dart doesn't support name extension until version 2.15

So you need at least Flutter 2.8.0

Ref: AVAudioSessionCategory.

Gustl22 avatar Aug 30 '22 23:08 Gustl22