toSingularName function

String toSingularName(
  1. String s
)

Convert field name to singular format

Implementation

String toSingularName(String s) => s.endsWith('ies')
    ? '${s.substring(0, s.length - 3)}y'
    : s.endsWith('ses') || s.endsWith('oes')
        ? '${s.substring(0, s.length - 2)}'
        : s.endsWith('s')
            ? s.substring(0, s.length - 1)
            : s;