getUserTargetRetention method

Future<double> getUserTargetRetention()

Implementation

Future<double> getUserTargetRetention() async {
  final userId = _client.auth.currentUser?.id;
  if (userId == null) return 0.9;
  final response = await _client
      .from('profiles')
      .select('target_retention')
      .eq('id', userId)
      .maybeSingle();
  if (response == null) return 0.9;
  return (response['target_retention'] as num?)?.toDouble() ?? 0.9;
}