Problem displaying fallback titles (romaji if english is missing) from AniList API in GridView

Database & APIs

Good evening guys,

I'm trying to display manga titles from the AniList API using a GridView in FlutterFlow. Each manga has multiple possible title formats (e.g., title.english, title.romaji). My goal is to show title.english by default, but if it's not available, fall back to title.romaji. I have created a custom function (getPreferredTitle) in Dart to handle the fallback logic, but it doesn't seem to return or display properly when used inside the widget's text property.

If someone can help me, will be very kind !

What have you tried so far?
  • Created a custom function: getPreferredTitle(Map<String, dynamic> title) => title['english'] ?? title['romaji'] ?? '';

  • Set up the JSON path in the API response for both $.title.english and $.title.romaji.

  • Set the variable as type JSON and passed it into the function from GridView items.

  • Tried using default values and conditional expressions.

  • Tried parsing the data differently but the text still shows as $.title or is blank.

Did you check FlutterFlow's Documentation for this topic?
No
2
2 replies