sortFieldsByName function

int sortFieldsByName(
  1. String a,
  2. String b
)

Public properties first, then sort alphabetically

Implementation

int sortFieldsByName(String a, String b) {
  final isAPrivate = isPrivateMember(a);
  final isBPrivate = isPrivateMember(b);

  if (isAPrivate && !isBPrivate) {
    return 1;
  }
  if (!isAPrivate && isBPrivate) {
    return -1;
  }

  return a.compareTo(b);
}