decode method

  1. @override
GeoGeometry decode(
  1. Object? value
)
override

Converts a SQLite storage value back to V.

Implementation

@override
GeoGeometry decode(Object? value) {
  if (value is! Uint8List) {
    throw const GeoException('geometry column is not a blob');
  }
  final geometry = GeoGeometry.fromWkb(value);
  if (type != null && geometry.type != type) {
    throw GeoException(
      'expected ${type!.wktName} and received ${geometry.type.wktName}',
    );
  }
  if (srid != null && srid != 0 && geometry.srid != srid) {
    throw GeoException('expected SRID $srid and received ${geometry.srid}');
  }
  return geometry;
}