How to debug custom actions/functions?

Custom Code
Resolved

Through my entire project I was trying to avoid using custom code, because it usually doesn't work (even when I use the correct Dart syntax), and it's very hard to debug. For instance, in the following code which GPT game me I am getting an "unknown error":

Future<bool> isBlocked(
    DocumentReference user2check, DocumentReference user) async {
  try {
    DocumentSnapshot userSnapshot = await user.get();

    if (!userSnapshot.exists)
      return false; // If B doesn't exist, A can't be blocked.

    List<dynamic>? blockedList = userSnapshot.get("blocked");

    if (blockedList == null)
      return false; // If there's no "blocked" field, A isn't blocked.

    return blockedList.contains(user2check);
  } catch (e) {
    print("Error checking block status: $e");
    return false;
  }
}

It is supposed to receive 2 doc references. One of them has a field with a list of doc references (of user doc ref) and I want to check if the first doc reference I receive as an input is in that list. If it is, I return true.
Supposed to be quite simple, but the syntax and my inability to debug it makes it impossible and such a long hassle that makes me wonder if writing the entire project in Dart directly would've been faster.

How do people write complex custom widgets/functions with FF? It's quite hard for me to work with it, and I haven't found much documentation. Are custom codes used in a different language than Dart? How do I know which packages I might need to add? Are there any tutorials I might've missed?

What have you tried so far?

Watching tutorials, GPT

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