Custom Action - Failed to process parameter

Custom Code

I Have this custom Action that is Failing to process the paramter. I have spent a couple of hours on it still getting the same reult. I have tried ChatGPT, Gemini and coPilot but even their suggestions are not working. can any point me in the right direction of where i should be going with this?

// Automatic FlutterFlow imports
import '/backend/schema/structs/index.dart';
import '/backend/supabase/supabase.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
import 'package:supabase_flutter/supabase_flutter.dart';

Future<void> updateCumulativeMetresForAllAction({
  required int machineId,
  required double mtrsFlt,
}) async {
  try {
    final supabase = Supabase.instance.client;

    // Retrieve the existing cumulative_metres value
    final response = await supabase
        .from('pipe_line_assignment')
        .select('cumulative_metres')
        .eq('machine_id', machineId)
        .eq('pipe_type_id', 2)
        .maybeSingle();

    if (response == null) {
      print('Error: No matching records found');
      return;
    }

    final cumulativeMetres = response['cumulative_metres'] as double;
    final updatedValue = cumulativeMetres + mtrsFlt;

    // Perform the update
    await supabase
        .from('pipe_line_assignment')
        .update({'cumulative_metres': updatedValue})
        .eq('machine_id', machineId)
        .eq('pipe_type_id', 2);

    print('Successfully updated cumulative_metres for machine: $machineId');
  } catch (e) {
    print('Error updating cumulative_metres: $e');
  }
}
What have you tried so far?

Used AI chats, Read various posts

Did you check FlutterFlow's Documentation for this topic?
No
3
1 reply