table property
The table associated with the model.
Implementation
@override
String get table {
final name = runtimeType.toString();
final snake = name
// Handle "HTTPServer" -> "HTTP_Server"
.replaceAllMapped(
RegExp(r'([A-Z]+)([A-Z][a-z])'),
(m) => '${m.group(1)}_${m.group(2)}',
)
// Handle "EducationStage" -> "Education_Stage"
.replaceAllMapped(
RegExp(r'([a-z0-9])([A-Z])'),
(m) => '${m.group(1)}_${m.group(2)}',
)
.toLowerCase();
return '${snake}s';
}