sms_autofill icon indicating copy to clipboard operation
sms_autofill copied to clipboard

Error with sms_autofill integration: "Type 'EditableTextContextMenuBuilder' not found."

Open gandhiidhruvv opened this issue 2 years ago • 5 comments

I encountered an issue while trying to integrate sms_autofill (version 2.2.0) into my project. The error message showed that the type "EditableTextContextMenuBuilder" was not found in the "pin_widget.dart" file.

The error message also stated that there is no named parameter with the name 'EditableTextContextMenuBuilder'.

../../Documents/software/flutter/.pub-cache/hosted/pub.dartlang.org/pin_input_text_field-4.4.0/lib/src/widget/pin_widget.dart:65:9: Error: Type 'EditableTextContextMenuBuilder' not found. final EditableTextContextMenuBuilder? contextMenuBuilder; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ../../Documents/software/flutter/.pub-cache/hosted/pub.dartlang.org/pin_input_text_field-4.4.0/lib/src/widget/pin_widget.dart:419:5: Error: Type 'EditableTextContextMenuBuilder' not found. EditableTextContextMenuBuilder? contextMenuBuilder, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ../../Documents/software/flutter/.pub-cache/hosted/pub.dartlang.org/pin_input_text_field-4.4.0/lib/src/widget/pin_widget.dart:65:9: Error: 'EditableTextContextMenuBuilder' isn't a type. final EditableText

while integrating sms_autofill, my project used the following dependencies:

version: 1.0.0+1 environment: sdk: '>=2.12.0 <3.0.0' dependencies: flutter: sdk: flutter get: ^4.6.5 connectivity_plus: ^2.3.6 shared_preferences: ^2.0.15 cached_network_image: ^3.2.1 flutter_svg: ^1.1.6 google_sign_in: ^5.0.7 flutter_switch: ^0.3.2 flutter_svg_provider: ^1.0.3 pin_code_fields: ^7.3.0 intl: ^0.17.0

Note that I did not use pin_input_text_field before, but the issue arose after adding sms_autofill to the project.

gandhiidhruvv avatar Feb 08 '23 10:02 gandhiidhruvv

@gandhiidhruvv Until this is fixed, I think you can go around this by overriding the pin_input_text_field version to an older one on your app's pubspec.yaml file. Something like:

dependency_overrides:
  .
  .
  .
  pin_input_text_field: 4.2.0

mahmoud-othmane avatar Feb 08 '23 15:02 mahmoud-othmane

@mahmoud-othmane thank you for your valuable suggestion, yesterday I also tried this solution, and its works for me. I forget to share my suggestion on this.

gandhiidhruvv avatar Feb 09 '23 05:02 gandhiidhruvv

Hi @gandhiidhruvv I was facing this issue just right now and I just upgraded my flutter SDK to 3.7.2 and the issue was gone. Kindly upgrade your flutter SDK

Thanks

danishkhawaja98 avatar Feb 09 '23 09:02 danishkhawaja98

hello @danishkhawaja98 Thanks for update , will do it once PM get agree to update the version

gandhiidhruvv avatar Feb 09 '23 09:02 gandhiidhruvv

@gandhiidhruvv Until this is fixed, I think you can go around this by overriding the pin_input_text_field version to an older one on your app's pubspec.yaml file. Something like:

dependency_overrides:
  .
  .
  .
  pin_input_text_field: 4.2.0

This is also the best approach if you are working with a team and your team uses the same flutter SDK.

danishkhawaja98 avatar Feb 09 '23 14:02 danishkhawaja98

should be ok on 2.4.0

jaumard avatar Jun 07 '24 10:06 jaumard

should be ok on 2.4.0

I'm still facing this issue on 2.4.0. The error message is as below: ../../.pub-cache/hosted/pub.dev/sms_autofill-2.4.0/lib/sms_autofill.dart:126:7: Error: No named parameter with the name 'contextMenuBuilder'. contextMenuBuilder: (context, editableTextState) { ^^^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/pin_input_text_field-4.2.0/lib/src/widget/pin_widget.dart:64:3: Context: Found this candidate, but the arguments don't match. PinInputTextField({ ^^^^^^^^^^^^^^^^^ Target kernel_snapshot failed: Exception

I am using Flutter SDK 3.16.5 and 3.2.3 Dart SDK and it's not working when I try to debug it on Android devices (I've tried Android 14 and Android 9) and an iPhone SE. I've also tried to add the dependency_overrides for pin_input_text_field: 4.2.0, but it's not working as well.

lybur avatar Jun 24 '24 01:06 lybur

should be ok on 2.4.0

I'm still facing this issue on 2.4.0. The error message is as below: ../../.pub-cache/hosted/pub.dev/sms_autofill-2.4.0/lib/sms_autofill.dart:126:7: Error: No named parameter with the name 'contextMenuBuilder'. contextMenuBuilder: (context, editableTextState) { ^^^^^^^^^^^^^^^^^^ ../../.pub-cache/hosted/pub.dev/pin_input_text_field-4.2.0/lib/src/widget/pin_widget.dart:64:3: Context: Found this candidate, but the arguments don't match. PinInputTextField({ ^^^^^^^^^^^^^^^^^ Target kernel_snapshot failed: Exception

I am using Flutter SDK 3.16.5 and 3.2.3 Dart SDK and it's not working when I try to debug it on Android devices (I've tried Android 14 and Android 9) and an iPhone SE. I've also tried to add the dependency_overrides for pin_input_text_field: 4.2.0, but it's not working as well.

Resolved issue by adding dependency override as below:

dependency_overrides:
  .
  .
  .
  pin_input_text_field: 4.4.0

lybur avatar Jun 24 '24 06:06 lybur

@lybur this package don't enforce any specific version but a range pin_input_text_field: '>=4.2.0 <5.0.0' so upgrading your dependencies should do the trick, you shouldn't need to overrides anything

jaumard avatar Jun 24 '24 06:06 jaumard

@lybur this package don't enforce any specific version but a range pin_input_text_field: '>=4.2.0 <5.0.0' so upgrading your dependencies should do the trick, you shouldn't need to overrides anything

I see, but no matter how many times I clear and clean the pub cache, it still uses pin_input_text_field 4.2.0. How does it decide which version to use?

lybur avatar Jun 24 '24 07:06 lybur

@lybur this package don't enforce any specific version but a range pin_input_text_field: '>=4.2.0 <5.0.0' so upgrading your dependencies should do the trick, you shouldn't need to overrides anything

I see, but no matter how many times I clear and clean the pub cache, it still uses pin_input_text_field 4.2.0. How does it decide which version to use?

Ok I get it now, I should just edit the version in pubspec.lock. Thank you!

lybur avatar Jun 24 '24 07:06 lybur

did you try flutter pub upgrade ? By default it take the versions in your pubspec.lock, if there is none it take the last version on compatible on pub. pub upgrade should put 4.4.0 in your .lock and unlock you situation

jaumard avatar Jun 24 '24 07:06 jaumard