I am getting the below error while trying to hold backspace for deleting characters in the password, when I tried to hold in an email it doesn't give me an error.
This is the below error:
====================================================================================================
======== Exception caught by services library ======================================================
The following RangeError was thrown during a platform message callback:
Value not in range: 9
When the exception was thrown, this was the stack:
#0 _StringBase.substring (dart:core-patch/string_patch.dart:399:7)
#1 TextRange.textBefore (dart:ui/text.dart:2785:17)
#2 RenderEditable.delete (package:flutter/src/rendering/editable.dart:1119:37)
#3 _DeleteTextAction.invoke (package:flutter/src/widgets/default_text_editing_actions.dart:88:45)
#4 ActionDispatcher.invokeAction (package:flutter/src/widgets/actions.dart:518:21)
...
====================================================================================================
======== Exception caught by services library ======================================================
The following RangeError was thrown during a platform message callback:
Value not in range: 9
When the exception was thrown, this was the stack:
#0 _StringBase.substring (dart:core-patch/string_patch.dart:399:7)
#1 TextRange.textBefore (dart:ui/text.dart:2785:17)
#2 RenderEditable.delete (package:flutter/src/rendering/editable.dart:1119:37)
#3 _DeleteTextAction.invoke (package:flutter/src/widgets/default_text_editing_actions.dart:88:45)
#4 ActionDispatcher.invokeAction (package:flutter/src/widgets/actions.dart:518:21)
...
====================================================================================================
and this is the below TextFormField I have:
DefaultTextFormField(
controller: passwordController,
type: TextInputType.visiblePassword,
suffix: controller.suffix,
onSubmit: (value) {
if (_formKey.currentState.validate()) {
controller.signInWithEmailAndPassword();
}
},
isPassword: controller.isPassword,
suffixPressed: () {
controller.changePasswordVisibility();
},
validate: (String value) {
if (value.isEmpty) {
return 'password is too short';
}
},
label: 'Password',
prefix: Icons.lock_outline,
),
and this is the below method I use for SignIn with email:
void signInWithEmailAndPassword() async {
try {
await _auth.signInWithEmailAndPassword(email: email, password: password);
Get.offAll(HomeView());
} catch (e) {
print(e.message);
Get.snackbar(
'Error login account',
e.message,
colorText: Colors.black,
snackPosition: SnackPosition.BOTTOM,
);
}
}
as I am using GetX State Management..
