Hey hello everbody!
I need to filter a Supabase view from the status argument parsed as a parameter. When checking for errors, I always get the same message:
The await expression can only be used in an async function. Try marking the function body with either 'async' or 'async*'.
import 'dart:convert'; import 'dart:math' as math; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:intl/intl.dart'; import 'package:timeago/timeago.dart' as timeago; import '/flutter_flow/lat_lng.dart'; import '/flutter_flow/place.dart'; import '/flutter_flow/uploaded_file.dart'; import '/flutter_flow/custom_functions.dart'; import '/backend/schema/structs/index.dart'; import '/backend/schema/enums/enums.dart'; import '/backend/supabase/supabase.dart'; import '/auth/supabase_auth/auth_util.dart'; import 'package:supabase_flutter/supabase_flutter.dart'; List<ViewreservasRow> filteringBookings(String? status) async { /// MODIFY CODE ONLY BELOW THIS LINE final query = Supabase.instance.client.from('viewreservas').select('*'); { if (status != null && status.isNotEmpty) query.eq('estado', status); } final response = await query.execute(); final data = response.data as List<dynamic>; final viewreservas = data.map((item) => ViewreservasRow(item)).toList(); return viewreservas; /// MODIFY CODE ONLY ABOVE THIS LINE }