marcglasberg / back_button_interceptor

Flutter Package: May be used to intercept the Android back-button, as an alternative to `WillPopScope`.
BSD 2-Clause "Simplified" License
105 stars 21 forks source link

A null exception occures during debug run in this package #19

Closed athJ closed 2 years ago

athJ commented 2 years ago

Steps to Reproduce

  1. Install flutter 2.10.5
  2. Install Android SDK 29
  3. Clone medito-app
  4. Install packages with pub
  5. Start android emulator or connect phone
  6. Run project in debug mode Expected results: The app up and running in the emulator or phone

Actual results: A null exception during build

Logs

Launching lib/main.dart on Android SDK built for x86 64 in debug mode... The app could not be configured for release signing. In app purchases will not be testable. Seeexample/README.md` for more info and instructions. : Error: Property 'handlePopRoute' cannot be accessed on 'WidgetsBinding?' because it is potentially null.

Try accessing using ?. instead. WidgetsBinding.instance.handlePopRoute; ^^^^^^^^^^^^^^ : Error: Property 'handlePushRoute' cannot be accessed on 'WidgetsBinding?' because it is potentially null.

FAILURE: Build failed with an exception.

BUILD FAILED in 1m 42s Exception: Gradle task assembleDebug failed with exit code 1 Exited (sigterm)`

   info • Unnecessary cast • lib/audioplayer/download_class.dart:83:38 • unnecessary_cast
   info • 'accentColor' is deprecated and shouldn't be used. Use colorScheme.secondary instead. For more information, consult
          the migration guide at
          https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. This feature was
          deprecated after v2.3.0-0.1.pre. • lib/main.dart:111:11 • deprecated_member_use
   info • This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance
          fields aren't final: ApiResponse.status, ApiResponse.body, ApiResponse.message • lib/network/api_response.dart:18:7 •
          must_be_immutable
   info • 'data' is deprecated and shouldn't be used. Use values below • lib/network/folder/folder_response.dart:21:23 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use values below • lib/network/folder/folder_response.dart:23:23 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use values below • lib/network/folder/folder_response.dart:25:29 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use values below • lib/network/folder/folder_response.dart:26:24 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use values below • lib/network/folder/folder_response.dart:27:36 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use values below • lib/network/folder/folder_response.dart:28:23 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use values below • lib/network/folder/folder_response.dart:31:20 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use values below • lib/network/folder/folder_response.dart:33:27 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use values below • lib/network/folder/folder_response.dart:38:5 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use values below • lib/network/folder/folder_response.dart:44:27 •
          deprecated_member_use_from_same_package
   info • 'idInt' is deprecated and shouldn't be used. Use id instead • lib/network/folder/folder_response.dart:110:20 •
          deprecated_member_use_from_same_package
   info • 'idInt' is deprecated and shouldn't be used. Use id instead • lib/network/folder/folder_response.dart:131:5 •
          deprecated_member_use_from_same_package
   info • 'idInt' is deprecated and shouldn't be used. Use id instead • lib/network/folder/folder_response.dart:140:18 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. User title and body instead •
          lib/network/home/daily_message_response.dart:5:23 • deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. User title and body instead •
          lib/network/home/daily_message_response.dart:7:22 • deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. User title and body instead •
          lib/network/home/daily_message_response.dart:12:5 • deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. User title and body instead •
          lib/network/home/daily_message_response.dart:17:14 • deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. User title and body instead •
          lib/network/home/daily_message_response.dart:18:27 • deprecated_member_use_from_same_package
   info • Unused import: 'package:connectivity/connectivity.dart' • lib/network/home/home_bloc.dart:22:8 • unused_import
   info • 'data' is deprecated and shouldn't be used. Use fields instead • lib/network/packs/announcement_response.dart:5:22 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use fields instead • lib/network/packs/announcement_response.dart:7:30 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use fields instead • lib/network/packs/announcement_response.dart:9:22 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use fields instead • lib/network/packs/announcement_response.dart:11:29 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use fields instead • lib/network/packs/announcement_response.dart:13:28 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use fields instead • lib/network/packs/announcement_response.dart:15:28 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use fields instead • lib/network/packs/announcement_response.dart:17:27 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use fields instead • lib/network/packs/announcement_response.dart:19:20 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use fields instead • lib/network/packs/announcement_response.dart:24:5 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. Use fields instead • lib/network/packs/announcement_response.dart:30:27 •
          deprecated_member_use_from_same_package
   info • 'coverOld' is deprecated and shouldn't be used. Use cover instead • lib/network/packs/packs_response.dart:47:23 •
          deprecated_member_use_from_same_package
   info • 'backgroundImage' is deprecated and shouldn't be used. Use backgroundImageUrl •
          lib/network/packs/packs_response.dart:51:36 • deprecated_member_use_from_same_package
   info • 'backgroundImage' is deprecated and shouldn't be used. Use backgroundImageUrl •
          lib/network/packs/packs_response.dart:82:5 • deprecated_member_use_from_same_package
   info • 'coverOld' is deprecated and shouldn't be used. Use cover instead • lib/network/packs/packs_response.dart:85:5 •
          deprecated_member_use_from_same_package
   info • 'backgroundImage' is deprecated and shouldn't be used. Use backgroundImageUrl •
          lib/network/packs/packs_response.dart:94:32 • deprecated_member_use_from_same_package
   info • 'coverOld' is deprecated and shouldn't be used. Use cover instead • lib/network/packs/packs_response.dart:97:21 •
          deprecated_member_use_from_same_package
   info • The value of the field '_screen' isn't used • lib/network/session_options/session_options_bloc.dart:37:10 •
          unused_field
   info • The value of the local variable 'options' isn't used • lib/network/session_options/session_options_bloc.dart:110:9 •
          unused_local_variable
   info • 'backgroundImage' is deprecated and shouldn't be used. Use backgroundImageUrl instead •
          lib/network/session_options/session_opts.dart:30:36 • deprecated_member_use_from_same_package
   info • 'author' is deprecated and shouldn't be used. use attribution instead •
          lib/network/session_options/session_opts.dart:33:29 • deprecated_member_use_from_same_package
   info • 'audio' is deprecated and shouldn't be used. use files instead • lib/network/session_options/session_opts.dart:34:32
          • deprecated_member_use_from_same_package
   info • 'backgroundImage' is deprecated and shouldn't be used. Use backgroundImageUrl instead •
          lib/network/session_options/session_opts.dart:64:5 • deprecated_member_use_from_same_package
   info • 'author' is deprecated and shouldn't be used. use attribution instead •
          lib/network/session_options/session_opts.dart:67:5 • deprecated_member_use_from_same_package
   info • 'audio' is deprecated and shouldn't be used. use files instead • lib/network/session_options/session_opts.dart:70:7 •
          deprecated_member_use_from_same_package
   info • 'audio' is deprecated and shouldn't be used. use files instead • lib/network/session_options/session_opts.dart:72:9 •
          deprecated_member_use_from_same_package
   info • 'backgroundImage' is deprecated and shouldn't be used. Use backgroundImageUrl instead •
          lib/network/session_options/session_opts.dart:85:32 • deprecated_member_use_from_same_package
   info • 'author' is deprecated and shouldn't be used. use attribution instead •
          lib/network/session_options/session_opts.dart:89:9 • deprecated_member_use_from_same_package
   info • 'author' is deprecated and shouldn't be used. use attribution instead •
          lib/network/session_options/session_opts.dart:90:24 • deprecated_member_use_from_same_package
   info • 'audio' is deprecated and shouldn't be used. use files instead • lib/network/session_options/session_opts.dart:92:9 •
          deprecated_member_use_from_same_package
   info • 'audio' is deprecated and shouldn't be used. use files instead • lib/network/session_options/session_opts.dart:93:23
          • deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. use fields instead • lib/network/text/text_response.dart:4:17 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. use fields instead • lib/network/text/text_response.dart:5:23 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. use fields instead • lib/network/text/text_response.dart:6:26 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. use fields instead • lib/network/text/text_response.dart:7:22 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. use fields instead • lib/network/text/text_response.dart:13:5 •
          deprecated_member_use_from_same_package
   info • 'data' is deprecated and shouldn't be used. use fields instead • lib/network/text/text_response.dart:19:27 •
          deprecated_member_use_from_same_package
   info • Unused import: 'package:package_info/package_info.dart' • lib/tracking/tracking.dart:20:8 • unused_import
   info • Unused import: 'package:Medito/tracking/tracking.dart' • lib/utils/stats_utils.dart:17:8 • unused_import
   info • 'await' applied to 'void', which is not a 'Future' • lib/utils/stats_utils.dart:304:7 • await_only_futures
   info • The import of 'package:flutter/cupertino.dart' is unnecessary because all of the used elements are also provided by
          the import of 'package:flutter/material.dart' • lib/utils/text_themes.dart:1:8 • unnecessary_import
   info • The import of 'package:flutter/widgets.dart' is unnecessary because all of the used elements are also provided by the
          import of 'package:flutter/material.dart' • lib/utils/text_themes.dart:3:8 • unnecessary_import
   info • 'canLaunch' is deprecated and shouldn't be used. Use canLaunchUrl instead • lib/utils/utils.dart:95:18 •
          deprecated_member_use
   info • 'launch' is deprecated and shouldn't be used. Use launchUrl instead • lib/utils/utils.dart:96:17 •
          deprecated_member_use
   info • 'canLaunch' is deprecated and shouldn't be used. Use canLaunchUrl instead • lib/utils/utils.dart:121:13 •
          deprecated_member_use
   info • 'launch' is deprecated and shouldn't be used. Use launchUrl instead • lib/utils/utils.dart:122:11 •
          deprecated_member_use
   info • The import of 'package:flutter/cupertino.dart' is unnecessary because all of the used elements are also provided by
          the import of 'package:flutter/material.dart' • lib/widgets/empty_widget.dart:3:8 • unnecessary_import
   info • The import of 'package:flutter/foundation.dart' is unnecessary because all of the used elements are also provided by
          the import of 'package:flutter/material.dart' • lib/widgets/folders/folder_nav_widget.dart:27:8 • unnecessary_import
   info • The import of 'package:flutter/cupertino.dart' is unnecessary because all of the used elements are also provided by
          the import of 'package:flutter/material.dart' • lib/widgets/home/daily_message_item_widget.dart:5:8 •
          unnecessary_import
   info • The import of 'package:flutter/cupertino.dart' is unnecessary because all of the used elements are also provided by
          the import of 'package:flutter/material.dart' • lib/widgets/home/small_shortcuts_row_widget.dart:7:8 •
          unnecessary_import
   info • 'accentColor' is deprecated and shouldn't be used. Use colorScheme.secondary instead. For more information, consult
          the migration guide at
          https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. This feature was
          deprecated after v2.3.0-0.1.pre. • lib/widgets/home/stats_widget.dart:175:15 • deprecated_member_use
   info • The import of 'package:flutter/cupertino.dart' is unnecessary because all of the used elements are also provided by
          the import of 'package:flutter/material.dart' • lib/widgets/home/streak_tile_widget.dart:18:8 • unnecessary_import
   info • The import of 'package:flutter/widgets.dart' is unnecessary because all of the used elements are also provided by the
          import of 'package:flutter/material.dart' • lib/widgets/home/streak_tile_widget.dart:20:8 • unnecessary_import
   info • 'backwardsCompatibility' is deprecated and shouldn't be used. This property is obsolete and is false by default. This
          feature was deprecated after v2.4.0-0.0.pre. • lib/widgets/main/app_bar_widget.dart:45:9 • deprecated_member_use
   info • 'brightness' is deprecated and shouldn't be used. This property is no longer used, please use systemOverlayStyle
          instead. This feature was deprecated after v2.4.0-0.0.pre. • lib/widgets/main/app_bar_widget.dart:46:9 •
          deprecated_member_use
   info • The import of 'package:flutter/cupertino.dart' is unnecessary because all of the used elements are also provided by
          the import of 'package:flutter/material.dart' • lib/widgets/packs/announcement_banner_widget.dart:21:8 •
          unnecessary_import
   info • The import of 'package:flutter/cupertino.dart' is unnecessary because all of the used elements are also provided by
          the import of 'package:flutter/material.dart' • lib/widgets/packs/error_widget.dart:19:8 • unnecessary_import
   info • Unused import: '../../main.dart' • lib/widgets/player/background_sounds_sheet_widget.dart:32:8 • unused_import
   info • The import of 'package:flutter/cupertino.dart' is unnecessary because all of the used elements are also provided by
          the import of 'package:flutter/material.dart' • lib/widgets/player/player2/player_widget_2.dart:34:8 •
          unnecessary_import
   info • The import of 'package:flutter/rendering.dart' is unnecessary because all of the used elements are also provided by
          the import of 'package:flutter/cupertino.dart' • lib/widgets/player/player2/player_widget_2.dart:36:8 •
          unnecessary_import
   info • The declaration '_getLoadingScreenWidget' isn't referenced • lib/widgets/player/player2/player_widget_2.dart:286:10 •
          unused_element
   info • Unused import: 'package:Medito/widgets/home/daily_message_item_widget.dart' •
          test/widgets/home/courses_row_item_widget_test.dart:3:8 • unused_import

83 issues found. (ran in 7.3s)

Flutter doctor -v

[✓] Flutter (Channel stable, 2.10.5, on macOS 12.3.1 21E258 darwin-x64, locale en-IN)
    • Flutter version 2.10.5 at /Users/atharvajagtap/fvm/versions/2.10.5
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5464c5bac7 (4 weeks ago), 2022-04-18 09:55:37 -0700
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/atharvajagtap/Library/Android
    • Platform android-31, build-tools 29.0.2
    • ANDROID_HOME = /Users/atharvajagtap/Library/Android
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_333.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 1.8.0_333-b02)
    • All Android licenses accepted.

[✗] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    ✗ CocoaPods installed but not working.
        You appear to have CocoaPods installed but it is not working.
        This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke
        it.
        This can usually be fixed by re-installing CocoaPods.
      To re-install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] VS Code (version 1.67.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.40.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.64

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.

humanolaranja commented 2 years ago

Same here

humanolaranja commented 2 years ago

Returning to back_button_interceptor: 5.0.2 worked for me

marcglasberg commented 2 years ago

@athJ Version 6.0.0 is for Flutter 3.0, as you can see here: https://pub.dev/packages/back_button_interceptor/changelog

To use Flutter 2, please use version back_button_interceptor: 5.0.2.