sortMentionsByLocationStart static method

int sortMentionsByLocationStart(
  1. MentionModel a,
  2. MentionModel b
)

Compare two mention models by position

Implementation

static int sortMentionsByLocationStart(MentionModel a, MentionModel b) {
  final aStart = a.locationStart;
  final bStart = b.locationStart;

  if (aStart != null && bStart != null) {
    return aStart.compareTo(bStart);
  }
  if (aStart != null) {
    return 1;
  }
  if (bStart != null) {
    return -1;
  }

  return 0;
}