getUserDetails method

Future<Map<String, String>?> getUserDetails(
  1. int userId
)

Implementation

Future<Map<String, String>?> getUserDetails(int userId) async {
  final db = await database;
  final result = await db.rawQuery(
    '''
  SELECT
    email,
    cellphone,
    first_name,
    last_name
  FROM
    users
  WHERE
    id = ?
  ''',
    [userId],
  );
  if (result.isNotEmpty) {
    return {
      'email': result.first['email'] as String? ?? '',
      'cellphone': result.first['cellphone'] as String? ?? '',
      'nombre_completo':
          '${result.first['first_name'] ?? ''} ${result.first['last_name'] ?? ''}'
              .trim(),
    };
  }
  return null;
}