Skip to content

Commit 3ee9d90

Browse files
authored
fix: handle PgDataType.voidType (#142)
* fix: handle PgDataType.voidType * add check to asText in default decoding case
1 parent e22e648 commit 3ee9d90

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/src/text_codec.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,18 @@ class PostgresTextDecoder<T extends Object> {
248248
// TODO: should we check for other representations (e.g. `1`, `on`, `y`,
249249
// and `yes`)?
250250
return (asText == 't' || asText == 'true') as T;
251+
252+
case PgDataType.voidType:
253+
// TODO: is returning `null` here is the appripriate thing to do?
254+
return null;
251255

252256
// We could list out all cases, but it's about 20 lines of code.
257+
// TODO: implement the rest of the types
253258
// ignore: no_default_cases
254259
default:
260+
if (asText is T) {
261+
return asText as T;
262+
}
255263
throw UnimplementedError('Text decoding for $_dataType');
256264
}
257265
}

0 commit comments

Comments
 (0)