Unexpected Behavior in String Contains Method: Partial Text Search Not Working

Database & APIs

I'm experiencing an issue with a custom function designed to perform a case-insensitive partial text search using contains(). Despite following standard implementation, the function only returns true when the entire text is entered, failing to detect partial matches. Here's the function:

bool? newCustomFunction( String? textSearchIn, String? textSearchFor, ) { return textSearchIn ?.toLowerCase() .contains(textSearchFor?.toLowerCase() ?? '') ?? false; }

I'am using this custom code to filter view of list view from api get

What have you tried so far?

Expected behavior:

  • The function should return true for any partial match (e.g., "Hello world" should match "wo").

Actual behavior:

  • Returns true only if the complete substring is entered.

Environment:

  • Flutter version: [specify your version]

  • Dart version: [specify your version]

I've verified inputs and tested with hard-coded values. Any insights or suggestions on what might be causing this issue or how to resolve it would be greatly appreciated.

Did you check FlutterFlow's Documentation for this topic?
Yes
1