Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to 3.0.1 calling EasyLoading.show shows a error: Null check operator used on a null value #125

Closed
Muzm opened this issue Aug 31, 2021 · 3 comments

Comments

@Muzm
Copy link

Muzm commented Aug 31, 2021

accroding to this . I upgrade flutter_easyloading: 3.0.0 to 3.0.1. and call EasyLoading.show();, My page become flutter red error screen and a error shows:

Null check operator used on a null value

The relevant error-causing widget was: 
  GestureDetector file:///Users/.../main.dart:192:14
When the exception was thrown, this was the stack: 
#0      EasyLoadingTheme.boxShadow (package:flutter_easyloading/src/theme.dart:59:43)
#1      _Indicator.build (package:flutter_easyloading/src/widgets/container.dart:198:37)
#2      StatelessElement.build (package:flutter/src/widgets/framework.dart:4648:28)
#3      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4574:15)
#4      Element.rebuild (package:flutter/src/widgets/framework.dart:4267:5)
...

flutter_easyloading/src/theme.dart:59:

/// boxShadow color of loading
  static List<BoxShadow>? get boxShadow =>
      EasyLoading.instance.loadingStyle == EasyLoadingStyle.custom
          ? EasyLoading.instance.boxShadow! // error because added "!" ?
          : null;

Flutter/Dart info
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.2 20G95 darwin-x64, locale
zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)

@github-actions
Copy link

Thanks for taking the time to open an issue. I will have a look and answer as soon as possible.

@nslogx
Copy link
Owner

nslogx commented Aug 31, 2021

please update to v3.0.2

@nslogx nslogx closed this as completed Aug 31, 2021
@Muzm
Copy link
Author

Muzm commented Aug 31, 2021

In 3.0.2 flutter_easyloading/src/theme.dart:59

  /// boxShadow color of loading
  static List<BoxShadow>? get boxShadow =>
      EasyLoading.instance.loadingStyle == EasyLoadingStyle.custom
          ? EasyLoading.instance.boxShadow ?? BoxShadow() 
          : null;

The boxShadow getter return value types is null or BoxShadow, not as expect List<BoxShadow>. correct code should be this:

  /// boxShadow color of loading
  static List<BoxShadow>? get boxShadow =>
      EasyLoading.instance.loadingStyle == EasyLoadingStyle.custom
          ? EasyLoading.instance.boxShadow ?? [BoxShadow()] // List<BoxShadow> : [BoxShadow()]
          : null;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants