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

Expected a value of type 'FutureOr<Flash<dynamic>>', but got one of type 'Null' #20

Closed
devj3ns opened this issue Mar 24, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@devj3ns
Copy link
Contributor

devj3ns commented Mar 24, 2021

When I run my Flutter web app with sound null safety I get this warning when the Flashbar disappears:

======== Exception caught by animation library =====================================================
The following TypeErrorImpl was thrown while notifying status listeners for AnimationController:
Expected a value of type 'FutureOr<Flash<dynamic>>', but got one of type 'Null'

When the exception was thrown, this was the stack: 
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 236:49      throw_
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 84:3        castError
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 442:10  cast
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/classes.dart 192:14     as_FutureOr
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 46:41                                         complete
...
The AnimationController notifying status listeners was: AnimationController#c75ed(⏮ 0.000; paused; DISPOSED; for FlashController<Flash<dynamic>>)
====================================================================================================

This is my code:

void showFlashbar(
    BuildContext context,
    String message, {
    required Color iconColor,
    required IconData icon,
    int duration = 3,
  }) {
    showFlash<Flash>(
      context: context,
      duration: Duration(seconds: duration),
      transitionDuration: const Duration(milliseconds: 750),
      builder: (context, controller) {
        return Flash<Flash>.bar(
          controller: controller,
          backgroundColor: const Color(0xFF303030),
          borderRadius: BorderRadius.circular(10),
          margin: const EdgeInsets.all(10),
          child: FlashBar(
            message: Text(
              message,
              style: const TextStyle(fontSize: 14.0, color: Colors.white),
            ),
            icon: Icon(
              icon,
              color: iconColor,
              size: 28,
            ),
          ),
        );
      },
    );
  }

I'm using flash: ^1.5.0 and Flutter v2.0.3 (stable)

@sososdk sososdk added the bug Something isn't working label Mar 25, 2021
@devj3ns
Copy link
Contributor Author

devj3ns commented Mar 25, 2021

Thanks @sososdk, for fixing it that quickly 💙

Could you please upload the new version to pub.dev as well?

The git dependency does not work:

Error on line 2, column 19: Unexpected character.
  ╷
2 │ description: âš¡ï¸�A highly customizable, powerful and easy-to-use alerting library for Flutter. 
  │                   ^
  ╵
pub get failed (65;   ╵)

@sososdk
Copy link
Owner

sososdk commented Mar 25, 2021

Hi @devj3ns, It was published: pub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants