Open mzohren opened 2 years ago
When entering a value into a MaskedTextField like this:
MaskedTextField( mask: kMaskIpv4, textFieldController: printerIpController, autofocus: true, inputDecoration: InputDecoration(hintText: printerIP), maxLength: kMaskIpv4.length, keyboardType: TextInputType.number, onChange: (value) { Dev.log(value, name: 'IP', type: runtimeType); })
and entering the final value or more, an exception is thrown:
The following RangeError was thrown while calling onChanged: RangeError (index): Invalid value: Not in inclusive range 0..14: 15 When the exception was thrown, this was the stack: #0 _StringBase.[] (dart:core-patch/string_patch.dart:260:41) #1 MaskedTextField.build.<anonymous closure> (package:masked_text_field/masked_text_field.dart:79:21) #2 EditableTextState._formatAndSetValue (package:flutter/src/widgets/editable_text.dart:2523:27) #3 EditableTextState.updateEditingValue (package:flutter/src/widgets/editable_text.dart:1888:7) #4 TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1593:37)
in above case
kMaskIpv4 = 'xxx.xxx.xxx.xxx'
and I'm entering a standard IPv4 eg192.168.0.1
mask: 'xxx.xxx.xxx.xxx.x'
limit: 15
When entering a value into a MaskedTextField like this:
MaskedTextField( mask: kMaskIpv4, textFieldController: printerIpController, autofocus: true, inputDecoration: InputDecoration(hintText: printerIP), maxLength: kMaskIpv4.length, keyboardType: TextInputType.number, onChange: (value) { Dev.log(value, name: 'IP', type: runtimeType); })
and entering the final value or more, an exception is thrown:
The following RangeError was thrown while calling onChanged: RangeError (index): Invalid value: Not in inclusive range 0..14: 15 When the exception was thrown, this was the stack: #0 _StringBase.[] (dart:core-patch/string_patch.dart:260:41) #1 MaskedTextField.build.<anonymous closure> (package:masked_text_field/masked_text_field.dart:79:21) #2 EditableTextState._formatAndSetValue (package:flutter/src/widgets/editable_text.dart:2523:27) #3 EditableTextState.updateEditingValue (package:flutter/src/widgets/editable_text.dart:1888:7) #4 TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1593:37)
in above case
kMaskIpv4 = 'xxx.xxx.xxx.xxx'
and I'm entering a standard IPv4 eg192.168.0.1
Error resolved in masked_text_field 1.0.2 please update
Alright, so we can close this issue.
When entering a value into a MaskedTextField like this:
and entering the final value or more, an exception is thrown:
in above case
kMaskIpv4 = 'xxx.xxx.xxx.xxx'
and I'm entering a standard IPv4 eg192.168.0.1