8 lines
343 B
Dart
8 lines
343 B
Dart
import 'dart:convert';
|
|
|
|
/// Content equality for API models that define no `==` but serialise to JSON.
|
|
/// Comparing the encoded strings is cheaper than a deep map walk and treats
|
|
/// both sides identically (same `toJson`, same field order).
|
|
bool sameJson(Object? a, Object? b) =>
|
|
a != null && b != null && jsonEncode(a) == jsonEncode(b);
|