36 lines
938 B
Dart
36 lines
938 B
Dart
|
import 'package:dartboard_resume/models/date_range.dart';
|
||
|
import 'package:dartboard_resume/models/document_text.dart';
|
||
|
|
||
|
class Experience {
|
||
|
Experience({
|
||
|
required this.subsection,
|
||
|
required this.title,
|
||
|
required this.attributes,
|
||
|
this.range,
|
||
|
this.location,
|
||
|
});
|
||
|
final String subsection;
|
||
|
final String title;
|
||
|
final List<DocumentText> attributes;
|
||
|
final DateRange? range;
|
||
|
String? location;
|
||
|
|
||
|
static bool filter(dynamic e) {
|
||
|
if (e is! List || !e.every((f) => f is Map)) {
|
||
|
return false;
|
||
|
}
|
||
|
final List<Map<String, dynamic>> entries = e.map((f) => f as Map<String, dynamic>).toList();
|
||
|
return entries.every((f) => f['title'] is String && f['attributes'] is List && f.keys.length >= 2);
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
int get hashCode {
|
||
|
return Object.hashAll([subsection, title, ...attributes, range]);
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
bool operator ==(Object other) {
|
||
|
return super.hashCode == other.hashCode;
|
||
|
}
|
||
|
}
|