PostgresByteaCodec class final

Converts between the bytes of a bytea column and the text PostgREST carries them as.

PostgREST serializes bytea values in the database's bytea_output format, hex by default (\x48656c6c6f), and Postgres accepts either format as input. encode renders hex; decode reads both hex and the escape format (Hello, \\, \000).

postgresBytea.encode(Uint8List.fromList([72, 105])) // \x4869
postgresBytea.decode(r'\x4869')                      // [72, 105]

The shared instance is postgresBytea. Filter values of type Uint8List and the rows generated by supabase_typegen go through it.

Inheritance
Annotations
  • @experimental

Constructors

PostgresByteaCodec()
Creates the codec; prefer the shared postgresBytea.
const

Properties

decoder → Converter<String, Uint8List>
Returns the decoder of this, converting from T to S.
no setteroverride
encoder → Converter<List<int>, String>
Returns the encoder from S to T.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
inverted → Codec<String, List<int>>
Inverts this.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

decode(String encoded) → Uint8List
Decodes the bytea literal encoded, hex or escape format.
override
encode(List<int> input) → String
Encodes input.
inherited
fuse<R>(Codec<String, R> other) → Codec<List<int>, R>
Fuses this with other.
inherited
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