@@ -4,11 +4,14 @@ import 'package:http/http.dart';
44import 'package:postgrest/postgrest.dart' ;
55import 'package:test/test.dart' ;
66
7- extension type Book (Map <String , dynamic > json) {
8- int get id => json['id' ] as int ;
9- String get title => json['title' ] as String ;
7+ extension type const Book (Map <String , dynamic > _json)
8+ implements Map <String , dynamic > {
9+ int get id => _json['id' ] as int ;
10+ String get title => _json['title' ] as String ;
1011}
1112
13+ const bookRows = '[{"id":1,"title":"a"},{"id":2,"title":"b"}]' ;
14+
1215class Books {
1316 static const table = PostgrestTable ('books' , Book .new );
1417 static const id = TableColumn <int >('id' );
@@ -41,8 +44,6 @@ void main() {
4144 late MockHttpClient httpClient;
4245 late PostgrestClient client;
4346
44- const bookRows = '[{"id":1,"title":"a"},{"id":2,"title":"b"}]' ;
45-
4647 setUp (() {
4748 httpClient = MockHttpClient ();
4849 client = PostgrestClient (
@@ -94,7 +95,7 @@ void main() {
9495 .where (Books .id.eq (1 ))
9596 .maybeSingle ();
9697
97- expect (book, isNull );
98+ expect (book == null , isTrue );
9899 });
99100
100101 test ('maybeSingle returns the row when one matches' , () async {
0 commit comments