How to pass argument into custom code

Actions & Logic

I have just switched form using a regular SQLite local DB to using PowerSync and it works great for offline use. PowerSync is pulling a table from Supabase to a PowerSync managed local SQLite DB. The queries happen in Custom actions such as the following:

Future<void> watchItems(
    Future Function(List<ItemsRow>? result) callback) async {
  var stream = db.watch('SELECT * FROM items');
  itemsSubscription
      ?.cancel(); //it's important to clean up any existing subscriptions otherwise app performance will degrade
  itemsSubscription = stream.listen((data) {
    callback(
        data.map((json) => ItemsRow(Map<String, dynamic>.from(json))).toList());
  });
}

This gives me all rows of the ITEMS table. I need to filter the query similar to the query I was using before with the native SQLite functionality: SELECT * from items WHERE treeParentId = ${treeParentId};

How do I format the custom action to accept an argument? I assume it may require declaring a variable on a separate line, but I cant figure it out.

Thanks.

What have you tried so far?

I tried using square brackets like variables in a API call and a dollar sign with curly brackets like a native SQLite query.

The documentation only discusses it when called in the first line of the function.

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