Agora-Flutter-SDK
Agora-Flutter-SDK copied to clipboard
Range Exception for AudioVolumeIndication
Describe the bug
I get an exception for RangeError in the AudioVolumeIndication callback inside the agora SDK in events.dart because the List only has 2 things according to the docs (aka range 0-1) but in the SDK they look for List Element[2] which is the 3rd element.
To Reproduce Steps to reproduce the behavior:
- Running an app with Audio Indication enabled
Expected behavior No exceptions should happen
Screenshots

Desktop (please complete the following information):
- Android and iOS
Smartphone (please complete the following information):
- Android Emulator and iOS15 iPhone 11 pro
Additional context It is commented out in one of the branches within the repo, I wonder if that's related. https://github.com/AgoraIO/Agora-Flutter-SDK/blob/dev/flutter2-iris/lib/src/events.dart#L1314
which version of SDK you used?
@LichKing-2234 I am facing same issue when running for android.
E/flutter (20383): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: RangeError (index): Invalid value: Not in inclusive range 0..1: 2
E/flutter (20383): #0 List.[] (dart:core-patch/growable_array.dart:254:60)
E/flutter (20383): #1 RtcEngineEventHandler.process (package:agora_rtc_engine/src/events.dart:1178:32)
E/flutter (20383): #2 RtcEngine.setEventHandler.<anonymous closure> (package:agora_rtc_engine/src/rtc_engine.dart:442:30)
E/flutter (20383): #3 _rootRunUnary (dart:async/zone.dart:1436:47)
E/flutter (20383): #4 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (20383): #5 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter (20383): #6 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
E/flutter (20383): #7 _DelayedData.perform (dart:async/stream_impl.dart:591:14)
E/flutter (20383): #8 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706:11)
E/flutter (20383): #9 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:663:7)
E/flutter (20383): #10 _rootRun (dart:async/zone.dart:1420:47)
E/flutter (20383): #11 _CustomZone.run (dart:async/zone.dart:1328:19)
E/flutter (20383): #12 _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
E/flutter (20383): #13 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
E/flutter (20383): #14 _rootRun (dart:async/zone.dart:1428:13)
E/flutter (20383): #15 _CustomZone.run (dart:async/zone.dart:1328:19)
E/flutter (20383): #16 _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
E/flutter (20383): #17 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
E/flutter (20383): #18 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
E/flutter (20383): #19 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
E/flutter (20383):
I am using agora_rtc_engine: git: url: https://github.com/AgoraIO/Agora-Flutter-SDK.git ref: dev/flutter2
What can be the reason? Do I need to add anything else, I have added await _engine.enableAudioVolumeIndication(200, 3, true);
Please help its urgent.
which version of SDK you used?
This was on version 4.0.6. And that was the odd thing, is that I don't think this version supports flutter web, but there is a platform check for Web
if you just want android or ios, you should use the latest version on pub.dev
@LichKing-2234 Actually I wanted for android/iOS and web as well. Can you please let me know which version is suitable as I have checked a lot there are only alpha versions which supports web but not working properly for web. And have checked many GitHub issues for web as well, you have commented on some issues to go for dev/flutter2 branch so I am using dev/flutter2 branch as plugin now working properly for web but throwing range exception in AudioVolumeIndication for android/iOS. Can you please help me out. Thanks
I think it's worth trying agora_rtc_engine: 6.0.0.
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please raise a new issue.