Skip to content

Commit 2b2a47a

Browse files
committed
chore: address DCM lint warnings
1 parent 6593b6c commit 2b2a47a

8 files changed

Lines changed: 22 additions & 18 deletions

packages/postgrest/lib/src/postgrest_typed_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void _toVoid(dynamic data) {}
2626
/// before it is returned, so awaiting it never exposes raw
2727
/// `Map<String, dynamic>` data.
2828
class PostgrestTypedBuilder<T> implements Future<T> {
29-
PostgrestTypedBuilder._(this._rawBuilder, this._convert);
29+
const PostgrestTypedBuilder._(this._rawBuilder, this._convert);
3030

3131
final PostgrestBuilder<dynamic, dynamic, dynamic> _rawBuilder;
3232
final T Function(dynamic data) _convert;

packages/postgrest/lib/src/postgrest_typed_filter_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ part of 'postgrest_typed_builder.dart';
66
/// checks the value type of each filter against its column at compile time.
77
class PostgrestTypedFilterBuilder<Row, T>
88
extends PostgrestTypedTransformBuilder<Row, T> {
9-
PostgrestTypedFilterBuilder._(
9+
const PostgrestTypedFilterBuilder._(
1010
PostgrestFilterBuilder<dynamic> super.rawBuilder,
1111
super.table,
1212
super.convert,

packages/postgrest/lib/src/postgrest_typed_query_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ part of 'postgrest_typed_builder.dart';
99
/// {@endtemplate}
1010
class PostgrestTypedQueryBuilder<Row> {
1111
/// {@macro postgrest_typed_query_builder}
12-
PostgrestTypedQueryBuilder(
12+
const PostgrestTypedQueryBuilder(
1313
PostgrestQueryBuilder<dynamic> queryBuilder,
1414
this.table,
1515
) : _queryBuilder = queryBuilder;

packages/postgrest/lib/src/postgrest_typed_transform_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ part of 'postgrest_typed_builder.dart';
55
/// [Row] is the type a single row converts into and [T] is the type the
66
/// request resolves to when awaited.
77
class PostgrestTypedTransformBuilder<Row, T> extends PostgrestTypedBuilder<T> {
8-
PostgrestTypedTransformBuilder._(
8+
const PostgrestTypedTransformBuilder._(
99
PostgrestTransformBuilder<dynamic> super.rawBuilder,
1010
this._table,
1111
super.convert,

packages/postgrest/test/typed_query_test.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ import 'package:http/http.dart';
44
import 'package:postgrest/postgrest.dart';
55
import '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+
1215
class 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 {

packages/supabase/lib/src/supabase_typed_query_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class SupabaseTypedQueryBuilder<Row> extends PostgrestTypedQueryBuilder<Row> {
1010
// The query builder is also kept as a field to expose [stream], so it
1111
// cannot become a super parameter.
1212
// ignore: use_super_parameters
13-
SupabaseTypedQueryBuilder(
13+
const SupabaseTypedQueryBuilder(
1414
SupabaseQueryBuilder queryBuilder,
1515
PostgrestTable<Row> table,
1616
) : _queryBuilder = queryBuilder,

packages/supabase/lib/src/supabase_typed_stream_builder.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import 'package:supabase/supabase.dart';
55
/// The typed counterpart of [SupabaseStreamBuilder]; emits the rows of the
66
/// table converted into [Row] through [PostgrestTable.rowFromJson].
77
class SupabaseTypedStreamBuilder<Row> extends Stream<List<Row>> {
8-
SupabaseTypedStreamBuilder(SupabaseStreamBuilder streamBuilder, this._table)
9-
: _streamBuilder = streamBuilder;
8+
const SupabaseTypedStreamBuilder(
9+
SupabaseStreamBuilder streamBuilder,
10+
this._table,
11+
) : _streamBuilder = streamBuilder;
1012

1113
final SupabaseStreamBuilder _streamBuilder;
1214
final PostgrestTable<Row> _table;
@@ -59,7 +61,7 @@ class SupabaseTypedStreamBuilder<Row> extends Stream<List<Row>> {
5961
/// A [SupabaseTypedStreamBuilder] that can still be filtered with [filter].
6062
class SupabaseTypedStreamFilterBuilder<Row>
6163
extends SupabaseTypedStreamBuilder<Row> {
62-
SupabaseTypedStreamFilterBuilder(
64+
const SupabaseTypedStreamFilterBuilder(
6365
SupabaseStreamFilterBuilder super.streamBuilder,
6466
super.table,
6567
);

packages/supabase/test/mock_test.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ import 'dart:io';
77
import 'package:supabase/supabase.dart';
88
import 'package:test/test.dart';
99

10-
extension type Todo(Map<String, dynamic> json) {
11-
int get id => json['id'] as int;
12-
String get task => json['task'] as String;
13-
bool get status => json['status'] as bool;
10+
extension type const Todo(Map<String, dynamic> _json)
11+
implements Map<String, dynamic> {
12+
int get id => _json['id'] as int;
13+
String get task => _json['task'] as String;
14+
bool get status => _json['status'] as bool;
1415
}
1516

1617
class Todos {

0 commit comments

Comments
 (0)