Skip to content

Null exception in _isAvailable whenever app moves to AppLifeCycleState paused #238

@robban112

Description

@robban112

Hi,

We're getting null exception errors in _isAvailable function for Pixel Android phones for Widgets wrapped in KeyboardAction with enabled set to false.

The reason for this is that setConfig is never called in initState, leading to config being set to null. Then, whenever AppLifeCycleState switches, _isAvailable will be called which force unwraps config leading to the exception.

Thanks.

Related error in Sentry / Console:

[sentry.platformError] [error] Uncaught Platform Error [sentry.platformError] _TypeError (Null check operator used on a null value) [sentry.platformError] #0 KeyboardActionstate._isAvailable (package:keyboard_actions/keyboard_actions.dart:127:18) #1 KeyboardActionstate._focusChanged (package:keyboard_actions/keyboard_actions.dart:267:9) #2 KeyboardActionstate.didChangeAppLifecycleState (package:keyboard_actions/keyboard_actions.dart:457:9) #3 WidgetsBinding.handleAppLifecycleStateChanged (package:flutter/src/widgets/binding.dart:794:16) #4 List.forEach (dart:core-patch/growable_array.dart:416:8) #5 ServicesBinding._handleLifecycleMessage (package:flutter/src/services/binding.dart:263:15) #6 BasicMessageChannel.setMessageHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:223:49) #7 _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:567:35) #8 _invoke2 (dart:ui/hooks.dart:344:13) #9 _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:45:5) #10 _Channel.push (dart:ui/channel_buffers.dart:135:31) #11 ChannelBuffers.push (dart:ui/channel_buffers.dart:343:17) #12 PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:722:22) #13 _dispatchPlatformMessage (dart:ui/hooks.dart:257:31)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions