LiewJunTung / pin_code_text_field

A highly customisable Flutter widget for entering pin code. Suitable for use cases such as login and OTP.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

onDone is called always, even if it's not required

talamaska opened this issue · comments

Describe the bug
I upgraded to flutter 2, I'm not using the latest version I'm on 1.7.1. Despite pub.dev displaying some 1.8.0 which I don't see here in master.
I haven't set onDone callback,
When I filled the fields I go an error in the console

The method 'call' was called on null.
Receiver: null
Tried calling: call("0000")

When the exception was thrown, this was the stack
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
#1      PinCodeTextFieldState._onTextChanged
package:pin_code_text_field/pin_code_text_field.dart:453
#2      EditableTextState._formatAndSetValue
package:flutter/…/widgets/editable_text.dart:2276
#3      EditableTextState.updateEditingValue
package:flutter/…/widgets/editable_text.dart:1731
#4      TextInput._handleTextInputInvocation

Expected behavior
Either make onDone required or make the onDone call conditional

Smartphone Emulator:

  • OS: Android
  • Version 29

Additional context
I see widget.onCHnaged is called with ?.call maybe onDone should also be called with this.

** flutter doctor **
[√] Flutter (Channel stable, 2.0.4, on Microsoft Windows [Version 10.0.19042.928], locale bg-BG)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] VS Code, 64-bit edition (version 1.55.2)
[√] Connected device (3 available)

@LiewJunTung any plans to fix the callback requirement?