feat: implement ExperienceAdapter and update ExperienceRepositoryImpl to use Data Connect and FirebaseAuth

This commit is contained in:
Achintha Isuru
2026-01-27 13:49:23 -05:00
parent 2f5c736c20
commit 157ace0e77
5 changed files with 64 additions and 12 deletions

View File

@@ -81,3 +81,4 @@ export 'src/entities/availability/day_availability.dart';
// Adapters
export 'src/adapters/profile/emergency_contact_adapter.dart';
export 'src/adapters/profile/experience_adapter.dart';

View File

@@ -0,0 +1,23 @@
import 'package:flutter/foundation.dart';
/// Adapter for Experience data (skills/industries) to map data layer values to domain models.
class ExperienceAdapter {
/// Converts a dynamic list (from backend AnyValue) to List<String>.
///
/// Handles nulls and converts elements to Strings.
static List<String> fromDynamicList(dynamic data) {
if (data == null) return [];
if (data is List) {
return data
.where((e) => e != null)
.map((e) => e.toString())
.toList();
}
// In case it comes as a map or single value, we treat it as empty or single?
// Safer to just return empty if not a list for now.
debugPrint('ExperienceAdapter: Expected List but got ${data.runtimeType}');
return [];
}
}