jhomlala/alice

[BUG] Getting the issue with new flutter release

Closed this issue · 9 comments

Describe the bug

../.pub-cache/hosted/pub.dev/alice-1.0.0-dev.10/lib/ui/calls_list/page/alice_calls_list_page.dart:270:63: Error: The argument type 'String?' can't be assigned to the parameter type 'String' because 'String?' is nullable and 'String' isn't.
OperatingSystem.isAndroid ? OpenFilex.open(result.path) : null,
^
../.pub-cache/hosted/pub.dev/alice-1.0.0-dev.10/lib/model/alice_export_result.dart:5:17: Context: 'path' refers to a public property so it couldn't be promoted.
See http://dart.dev/go/non-promo-public-field
final String? path;
^
../.pub-cache/hosted/pub.dev/alice-1.0.0-dev.10/lib/model/alice_export_result.dart:5:17: Context: 'path' couldn't be promoted because field promotion is only available in Dart 3.2 and above.
See http://dart.dev/go/non-promo-field-promotion-unavailable
final String? path;
^
To Reproduce
Steps to reproduce the behavior:

  1. Update the flutter to latest stable.
  2. Run the build after cleaning

Expected behavior
application should build.

Alice version

  • [Version](alice: ^1.0.0-dev.10)

@UmairRehmat1 could you please provide a few more details regarding your setup?

@techouse
I try running the alice_dio from example and it also failed.

Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.0, on Microsoft Windows [Version 10.0.22631.3880], locale en-ID)
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Android Studio (version 2024.1)
[✓] IntelliJ IDEA Community Edition (version 2024.1)
[✓] VS Code (version 1.92.2)
[✓] Connected device (1 available)
[✓] Network resources

• No issues found!
Log
Resolving dependencies...
Downloading packages...
! alice 1.0.0-dev.11 from path ..\..\packages\alice (overridden)
! alice_dio 1.0.5 from path ..\..\packages\alice_dio (overridden)
+ args 2.5.0
+ async 2.11.0
+ characters 1.3.0
+ clock 1.1.1
+ collection 1.18.0 (1.19.0 available)
+ cross_file 0.3.4+2
+ crypto 3.0.5
+ dbus 0.7.10
+ dio 5.6.0
+ dio_web_adapter 2.0.0
+ equatable 2.0.5
+ ffi 2.1.3
+ file 7.0.0
+ fixnum 1.1.0
+ flutter 0.0.0 from sdk flutter
+ flutter_lints 4.0.0
+ flutter_local_notifications 17.2.2
+ flutter_local_notifications_linux 4.0.1
+ flutter_local_notifications_platform_interface 7.2.0
+ flutter_web_plugins 0.0.0 from sdk flutter
+ http 1.2.2
+ http_parser 4.0.2 (4.1.0 available)
+ lints 4.0.0
+ logging 1.2.0
+ material_color_utilities 0.11.1 (0.12.0 available)
+ meta 1.15.0
+ mime 1.0.5
+ open_filex 4.5.0
+ package_info_plus 8.0.2
+ package_info_plus_platform_interface 3.0.1
+ path 1.9.0
+ path_provider 2.1.4
+ path_provider_android 2.2.10
+ path_provider_foundation 2.4.0
+ path_provider_linux 2.2.1
+ path_provider_platform_interface 2.1.2
+ path_provider_windows 2.3.0
+ permission_handler 11.3.1
+ permission_handler_android 12.0.12
+ permission_handler_apple 9.4.5
+ permission_handler_html 0.1.3+1
+ permission_handler_platform_interface 4.2.2
+ permission_handler_windows 0.2.1
+ petitparser 6.0.2
+ platform 3.1.5
+ plugin_platform_interface 2.1.8
+ rxdart 0.27.7 (0.28.0 available)
+ sensors_plus 5.0.1 (6.0.1 available)
+ sensors_plus_platform_interface 1.2.0 (2.0.0 available)
+ share_plus 9.0.0 (10.0.2 available)
+ share_plus_platform_interface 4.0.0 (5.0.0 available)
+ sky_engine 0.0.99 from sdk flutter
+ source_span 1.10.0
+ sprintf 7.0.0
+ string_scanner 1.3.0
+ term_glyph 1.2.1
+ timezone 0.9.4
+ typed_data 1.3.2
+ url_launcher 6.3.0
+ url_launcher_android 6.3.9
+ url_launcher_ios 6.3.1
+ url_launcher_linux 3.2.0
+ url_launcher_macos 3.2.0
+ url_launcher_platform_interface 2.3.2
+ url_launcher_web 2.3.3
+ url_launcher_windows 3.1.2
+ uuid 4.4.2
+ vector_math 2.1.4
+ web 0.5.1 (1.0.0 available)
+ win32 5.5.4
+ xdg_directories 1.0.4
+ xml 6.5.0
Changed 72 dependencies!
9 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
Launching lib\main.dart on Redmi 4 Prime in debug mode...
Running Gradle task 'assembleDebug'...
../../packages/alice/lib/ui/calls_list/page/alice_calls_list_page.dart:270:63: Error: The argument type 'String?' can't be assigned to the parameter type 'String' because 'String?' is nullable and 'String' isn't.
            OperatingSystem.isAndroid ? OpenFilex.open(result.path) : null,
                                                              ^
../../packages/alice/lib/model/alice_export_result.dart:5:17: Context: 'path' refers to a public property so it couldn't be promoted.
See http://dart.dev/go/non-promo-public-field
  final String? path;
                ^
../../packages/alice/lib/model/alice_export_result.dart:5:17: Context: 'path' couldn't be promoted because field promotion is only available in Dart 3.2 and above.
See http://dart.dev/go/non-promo-field-promotion-unavailable
  final String? path;
                ^
Target kernel_snapshot_program failed: Exception


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\sdk\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 39s
Error: Gradle task assembleDebug failed with exit code 1

It's just need to add ! on line 270 😅

 secondButtonAction: () =>
            OperatingSystem.isAndroid ? OpenFilex.open(result.path!) : null,

@UmairRehmat1 could you please provide a few more details regarding your setup?

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.3, on macOS 14.5 23F79 darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.88.0)
[✓] Connected device (4 available)
! Error: Browsing on the local area network for Umair’s iphone. Ensure the device is unlocked and attached with a cable or associated
with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
! Error: Browsing on the local area network for MP phone. Ensure the device is unlocked and attached with a cable or associated with the
same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

alice: (alice: ^1.0.0-dev.10)

It's just need to add ! on line 270 😅

 secondButtonAction: () =>
            OperatingSystem.isAndroid ? OpenFilex.open(result.path!) : null,

Please raise a PR

Hi @jhomlala, can we get this moving?

What about this?

        secondButtonAction: () {
          final path = result.path;
          return path != null ? (OperatingSystem.isAndroid ? OpenFilex.open(path) : null) : null;
        },

So could the author get going with this issue? I have to use old Flutter SDK for my project because of this...

You can always use the PR fork in your pubspec.yaml or even make your own fork and use that until it's merged.