Closed johnvuko closed 3 weeks ago
I get the same via Crashlytics
Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: RangeError (index): Invalid value: Not in inclusive range 0..6: 9. Error thrown null.
at _StringBase.[](_StringBase.java)
at AsYouTypeFormatter.formatEditUpdate.<fn>(formatEditUpdate.java:55)
Package Version
intl_phone_number_input: ^0.7.0+2
▶ flutter doctor -v
[✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-x64, locale de-DE)
• Flutter version 2.5.3 at /Users/me/Development/sdks/flutter
• Upstream repository git@github.com:flutter/flutter.git
• Framework revision 18116933e7 (vor 3 Wochen), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
Device Brand:HTC Model:U11 Orientation: Portrait RAM free: 1.57 GB Disk free: 47.32 GB Operating system Version:Android 9 Orientation: Portrait Rooted:No
I have the same error too because to enter for example letters on the phone field.
Any solution for this problem? The same happens to me.
I do not encounter a crash BUT in France the range includes +337 (not only +336) and isValid
from callbacks is always false for a valid phone number like : +33708091011
We're seeing the same issue in Sentry with intl_phone_number_input: 0.7.1
Error is from the last line of code in this section of as_you_type_formatter.dart
int offset =
newValue.selection.end == -1 ? 0 : newValue.selection.end;
if (separatorChars.hasMatch(parsedText)) {
String valueInInputIndex = parsedText[offset - 1];
Looks like it relates to having the cursor at the end of the input?
RangeError: RangeError (index): Invalid value: Not in inclusive range 0..6: 7
File "string_patch.dart", line 260, in _StringBase.[]
File "as_you_type_formatter.dart", line 55, in AsYouTypeFormatter.formatEditUpdate.<fn>
On multiple devices:
Device: OnePlus8Pro, Android 11 Device: iPhone 14, iOS 16.2
I'm able to reliably reproduce on v0.7.1 and 0.7.2. Here's how:
InternationalPhoneNumberInput(
formatInput: true,
onInputChanged: (PhoneNumber number) {},
);
I/flutter (25273): ----------------FIREBASE CRASHLYTICS----------------
I/flutter (25273): RangeError (index): Invalid value: Not in inclusive range 0..6: 7
I/flutter (25273): #0 _StringBase.[] (dart:core-patch/string_patch.dart:258:41)
I/flutter (25273): #1 AsYouTypeFormatter.formatEditUpdate.<anonymous closure> (package:intl_phone_number_input/src/utils/formatter/as_you_type_formatter.dart:54:50)
I/flutter (25273): <asynchronous suspension>
I/flutter (25273): ----------------------------------------------------
I'd guess the length of input needed to trigger the error occurs as a function of the country code and that, somewhere in the call stack, the program isn't expecting the user to be entering hyphens when formatInput
is set to true
.
From my experience, the error is fairly benign meaning it doesn't cause a fatal app crash. Still, it pollutes the error tracking tools with noise making it hard to separate the wheat from the chaff.
This still appears to be an issue with 0.7.3+1
This is still happening. To reproduce, enter any non-digit character into the field. It gets parsed out, but the offset does not get updated and it throws a Range error.
As previously mentioned it happens in as_you_type_formatter.dart
line 57 version 0.7.3+1
if (separatorChars.hasMatch(parsedText)) {
String valueInInputIndex = parsedText[offset - 1];
...
This is again a trending error for me in Crashlytics with version 0.7.3+1
This issue has 66 crash events affecting 42 users
RangeError (index): Invalid value: Not in inclusive range 0..12: 14
Hello guys, Any update on this subject ? Thanks
I got this same crash, the first time I tested the library.
I can confirm that these steps to reproduce do work: https://github.com/natintosh/intl_phone_number_input/issues/245#issuecomment-1413548171
This happens when the format has space
Exactly, I'm getting the issue with Brazilian Mobile Phone.
Maybe, this can help: https://github.com/natintosh/intl_phone_number_input/pull/425
I got the same. And i have found out the problem due to the user tap to the space
character in phone number keyboard.
Awesome, I'll test it as soon as possible
Describe the bug I just have a report from Sentry, no information about how to reproduce.
Package version 0.7.0+2
Flutter version 2.2.3
To Reproduce Unknown, I just have the crash report from Sentry without anything else.
Expected behavior Not to bug.
Targeted platforms (please complete the following information)
Here the full crash report (no information from my own code strangely):
Here how to input is used: