GridSheetSorter class

Default sorting logic for GridSheet columns.

This class provides the built-in comparison logic used when no custom comparator is registered for a column. It handles common data types with sensible defaults.

Comparison Rules

  1. Null Values: Always sorted last (after non-null values)
  2. Numbers: Natural numeric comparison (1 < 2 < 10)
  3. Dates: Chronological order (earliest to latest)
  4. Strings: Case-insensitive alphabetical order
  5. Other Types: Converted to strings and compared alphabetically

Usage

The default comparator is used automatically. You can also call it directly for custom sorting logic:

final result = GridSheetSorter.defaultCompare('apple', 'Banana');
// result < 0 because 'apple' comes before 'banana' (case-insensitive)

See also:

Constructors

GridSheetSorter()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

defaultCompare(dynamic a, dynamic b) int
Compares two values using default sorting rules.