getEntityID<O> method
Returns the ID value from object
for type
.
Implementation
@override
Object? getEntityID<O>(O object,
{Type? type, dynamic Function(O o)? idGetter}) {
if (object == null) return null;
if (idGetter != null) {
return idGetter(object);
}
type ??= object.runtimeType;
var classReflection = ReflectionFactory().getRegisterClassReflection(type);
if (classReflection != null) {
var fieldID = classReflection
.fieldsWhere((f) => f.name.toLowerCase() == 'id')
.firstOrNull;
fieldID ??=
classReflection.fieldsWhere((f) => f.type.isIntType).firstOrNull;
return fieldID?.withObject(object).get();
}
return null;
}