RatelHub / rflutter_alert

RFlutter Alert is super customizable and easy-to-use alert / popup dialog library for Flutter. You may create reusable alert styles or add buttons as much as you want with ease.
https://ratel.com.tr
MIT License
386 stars 117 forks source link

The method 'call' was called on null. #56

Closed hassan1709 closed 4 years ago

hassan1709 commented 4 years ago

When pressing the close button (the x on top right corner) it does shows the following Exception on console although all seems to work ok on the screen:

════════ Exception caught by gesture ═══════════════════════════════════════════════════════════════ The following NoSuchMethodError was thrown while handling a gesture: The method 'call' was called on null. Receiver: null Tried calling: call()

When the exception was thrown, this was the stack:

0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)

1 Alert._getCloseButton. (package:rflutter_alert/src/alert.dart:166:23)

2 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)

3 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:789:36)

4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)

... Handler: "onTap" Recognizer: TapGestureRecognizer#e1503 debugOwner: GestureDetector state: possible won arena finalPosition: Offset(348.3, 216.0) finalLocalPosition: Offset(6.8, 13.8) button: 1 sent tap down

hassan1709 commented 4 years ago

When pressing the close button (the x on top right corner) it does shows the following Exception on console although all seems to work ok on the screen:

════════ Exception caught by gesture ═══════════════════════════════════════════════════════════════ The following NoSuchMethodError was thrown while handling a gesture: The method 'call' was called on null. Receiver: null Tried calling: call()

When the exception was thrown, this was the stack:

0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)

1 Alert._getCloseButton. (package:rflutter_alert/src/alert.dart:166:23)

2 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)

3 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:789:36)

4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)

... Handler: "onTap" Recognizer: TapGestureRecognizer#e1503 debugOwner: GestureDetector state: possible won arena finalPosition: Offset(348.3, 216.0) finalLocalPosition: Offset(6.8, 13.8) button: 1 sent tap down

I found out that you just need to set "closeFunction". Maybe just update your Readme or your how to use.

Thank you anyways, it's a great package.

ashishsoni commented 4 years ago

@hassan1709 how do you do that .. can you given and example

notTural commented 4 years ago

You can get around the error by passing an empty function to the closeFunction field. Alert( closeFunction: () {}, ... )

ibrahimdevs commented 4 years ago

@hassan1709 we fixed it in V1.0.6, please try the latest version.