question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG]: Unhandled Exception: type 'bool' is not a subtype of type 'int' in type cast

See original GitHub issue

Flutter Sound Version : 7.7.0+1

Severity: result is not what expected

Platforms you faced the error: Android, Emulator


Describe the bug Can’t reproduce audio from headset. [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: type ‘bool’ is not a subtype of type ‘int’ in type cast** Same error occurs when calling await _playerModule.setAudioFocus();

To Reproduce

      await _playerModule.setAudioFocus(
          focus: AudioFocus.requestFocusAndKeepOthers,
          category: SessionCategory.playback,
          mode: SessionMode.modeDefault,
          device: AudioDevice.headset,
          audioFlags:allowHeadset
      );

Logs

I/flutter (15968): <--- startPlayerCompleted: true
I/flutter (15968): FS:<--- channelMethodCallHandler : startPlayerCompleted
I/flutter (15968): FS:---> setAudioFocus 
E/flutter (15968): **[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: type 'bool' is not a subtype of type 'int' in type cast**
E/flutter (15968): #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:41)
E/flutter (15968): <asynchronous suspension>
E/flutter (15968): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:332:12)
E/flutter (15968): #2      MethodChannelFlutterSoundPlayer.invokeMethod (package:flutter_sound_platform_interface/method_channel_flutter_sound_player.dart:192:21)
E/flutter (15968): #3      MethodChannelFlutterSoundPlayer.setAudioFocus (package:flutter_sound_platform_interface/method_channel_flutter_sound_player.dart:227:12)
E/flutter (15968): #4      FlutterSoundPlayer._setAudioFocus (package:flutter_sound/public/flutter_sound_player.dart:745:59)
E/flutter (15968): <asynchronous suspension>
E/flutter (15968): #5      FlutterSoundPlayer.setAudioFocus.<anonymous closure> (package:flutter_sound/public/flutter_sound_player.dart:722:13)
E/flutter (15968): #6      BasicLock.synchronized (package:synchronized/src/basic_lock.dart:32:26)
E/flutter (15968): #7      FlutterSoundPlayer.setAudioFocus (package:flutter_sound/public/flutter_sound_player.dart:721:17)
E/flutter (15968): #8      _MyAppState._startPlayer (package:faceroom/screens/chat/messages/audio_player_widget.dart:205:29)
E/flutter (15968): <asynchronous suspension>
E/flutter (15968): #9      _MyAppState._onStartPlayerPressed (package:faceroom/screens/chat/messages/audio_player_widget.dart:248:34)
E/flutter (15968): #10     _MyAppState.build.<anonymous closure> (package:faceroom/screens/chat/messages/audio_player_widget.dart:287:38)
E/flutter (15968): #11     _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:993:19)
E/flutter (15968): #12     _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:1111:38)
E/flutter (15968): #13     GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:183:24)
E/flutter (15968): #14     TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:598:11)
E/flutter (15968): #15     BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:287:5)
E/flutter (15968): #16     BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:259:7)
E/flutter (15968): #17     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:157:27)
E/flutter (15968): #18     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:362:20)
E/flutter (15968): #19     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:338:22)
E/flutter (15968): #20     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:267:11)
E/flutter (15968): #21     GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:295:7)
E/flutter (15968): #22     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:240:7)
E/flutter (15968): #23     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:213:7)
E/flutter (15968): #24     _rootRunUnary (dart:async/zone.dart:1206:13)
E/flutter (15968): #25     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (15968): #26     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (15968): #27     _invoke1 (dart:ui/hooks.dart:265:10)
E/flutter (15968): #28     _dispatchPointerDataPacket (dart:ui/hooks.dart:174:5)
E/flutter (15968): 
D/FlautoPlayer(15968): Playback completed.
V/MediaPlayer(15968): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(15968): cleanDrmObj: mDrmObj=null mDrmSessionId=null
V/MediaPlayer(15968): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(15968): cleanDrmObj: mDrmObj=null mDrmSessionId=null
I/flutter (15968): FS:---> channelMethodCallHandler : audioPlayerFinishedPlaying
I/flutter (15968): FS:---> audioPlayerFinished
I/flutter (15968): FS:---> stopPlayer 
I/flutter (15968): FS:---> stop 

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
marcoberetta96commented, May 24, 2021

Hi @Larpoux I have just tried with flutter_sound 8.1.4 Have you any update on this?

0reactions
marcoberetta96commented, Apr 25, 2021

Hi @Larpoux have you any update on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

flutter - Unhandled Exception: type 'bool' is not a subtype of ...
Unhandled Exception : type 'bool' is not a subtype of type 'String?' in type cast while trying to open a box in Hive...
Read more >
type 'int' is not a subtype of type 'bool' · Issue #38696 · flutter ...
This issue seems straight-forward but its not. ... Unhandled Exception: type 'int' is not a subtype of type 'bool' #38696.
Read more >
type 'Null' is not a subtype of type 'String' in type cast flutter
This will fix the error type 'int' is not a subtype of type 'double' To fix type 'double' is not a subtype of...
Read more >
[SOLVED] Flutter : Unhandled Exception: type 'int' is not a ...
Problem. I'm Calling An API to update my data and I got this error, the Error Says, E/flutter (32582): type 'int' is not...
Read more >
Fixing common type problems - Dart programming language
error - A value of type 'int' can't be assigned to a variable of type ... Try changing the type of the variable,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found