audioplayers
audioplayers copied to clipboard
correcting name of existing getter error
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(),`
same question
Did you try flutter clean
? Does the example work for you? Do you have an example project? Also use the issue template!
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.
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
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.
I met the same issue, Is there anyone solved it?
I have the same issue. Any solution? @liang-notes?
@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.