Skip to content

Commit 4b5d150

Browse files
authored
Fixed Dart SDK version for Flutter 3.22.x (#9) and Updated dependencies (#12)
1 parent 0bdfa89 commit 4b5d150

File tree

11 files changed

+87
-119
lines changed

11 files changed

+87
-119
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
## [1.0.1] - 2024-08-30
1+
## [1.1.0] - 2024-08-30
2+
#### [@danbeech](https://github.com/danbeech)
23
#### [@rickypid](https://github.com/rickypid)
34

45
### Fixed
56

67
* Fixed update room call
8+
* Fixed Dart SDK version for Flutter 3.22.x (#9)
9+
* Updated dependencies
710

811
## [1.0.0] - 2024-06-19
912
#### [@rickypid](https://github.com/rickypid)

analysis_options.yaml

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
analyzer:
2-
plugins:
3-
- dart_code_metrics
4-
51
include: package:flutter_lints/flutter.yaml
62

73
linter:
84
rules:
9-
# avoid_print: false # Uncomment to disable the `avoid_print` rule
10-
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
115
- always_declare_return_types
126
- avoid_unused_constructor_parameters
137
- directives_ordering
@@ -24,23 +18,5 @@ linter:
2418
- unawaited_futures
2519
- use_named_constants
2620
- use_super_parameters
21+
- require_trailing_commas
2722

28-
dart_code_metrics:
29-
rules:
30-
- always-remove-listener
31-
- avoid-unused-parameters
32-
- format-comment
33-
- member-ordering:
34-
alphabetize: false
35-
order:
36-
- constructors
37-
- public-fields
38-
- public-getters
39-
- public-setters
40-
- private-fields
41-
- private-getters
42-
- private-setters
43-
- public-methods
44-
- private-methods
45-
- no-boolean-literal-compare
46-
- prefer-trailing-comma

example/analysis_options.yaml

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
analyzer:
2-
plugins:
3-
- dart_code_metrics
4-
51
include: package:flutter_lints/flutter.yaml
62

73
linter:
84
rules:
9-
# avoid_print: false # Uncomment to disable the `avoid_print` rule
10-
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
115
- always_declare_return_types
126
- avoid_unused_constructor_parameters
137
- directives_ordering
@@ -24,25 +18,5 @@ linter:
2418
- unawaited_futures
2519
- use_named_constants
2620
- use_super_parameters
21+
- require_trailing_commas
2722

28-
dart_code_metrics:
29-
rules-exclude:
30-
- lib/firebase_options.dart
31-
rules:
32-
- always-remove-listener
33-
- avoid-unused-parameters
34-
- format-comment
35-
- member-ordering:
36-
alphabetize: false
37-
order:
38-
- constructors
39-
- public-fields
40-
- public-getters
41-
- public-setters
42-
- private-fields
43-
- private-getters
44-
- private-setters
45-
- public-methods
46-
- private-methods
47-
- no-boolean-literal-compare
48-
- prefer-trailing-comma

example/lib/chat.dart

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,12 @@ class _ChatPageState extends State<ChatPage> {
9191
final bytes = result.files.single.bytes;
9292
final name = result.files.single.name;
9393
final mimeType = lookupMimeType(name, headerBytes: bytes);
94-
final reference = await Supabase.instance.client.storage
95-
.from(buket)
96-
.uploadBinary(
97-
'${widget.room.id}/${const Uuid().v1()}-$name', bytes!,
98-
fileOptions: FileOptions(contentType: mimeType));
94+
final reference =
95+
await Supabase.instance.client.storage.from(buket).uploadBinary(
96+
'${widget.room.id}/${const Uuid().v1()}-$name',
97+
bytes!,
98+
fileOptions: FileOptions(contentType: mimeType),
99+
);
99100
final url =
100101
'${Supabase.instance.client.storage.url}/object/authenticated/$reference';
101102
final message = types.PartialFile(
@@ -127,10 +128,12 @@ class _ChatPageState extends State<ChatPage> {
127128
final name = result.name;
128129
final mimeType = lookupMimeType(name, headerBytes: bytes);
129130
try {
130-
final reference = await Supabase.instance.client.storage
131-
.from(buket)
132-
.uploadBinary('${widget.room.id}/${const Uuid().v1()}-$name', bytes,
133-
fileOptions: FileOptions(contentType: mimeType));
131+
final reference =
132+
await Supabase.instance.client.storage.from(buket).uploadBinary(
133+
'${widget.room.id}/${const Uuid().v1()}-$name',
134+
bytes,
135+
fileOptions: FileOptions(contentType: mimeType),
136+
);
134137
final url =
135138
'${Supabase.instance.client.storage.url}/object/authenticated/$reference';
136139
final message = types.PartialImage(
@@ -219,8 +222,9 @@ class _ChatPageState extends State<ChatPage> {
219222
message.author.id !=
220223
SupabaseChatCore.instance.supabaseUser!.id) {
221224
await SupabaseChatCore.instance.updateMessage(
222-
message.copyWith(status: types.Status.seen),
223-
widget.room.id);
225+
message.copyWith(status: types.Status.seen),
226+
widget.room.id,
227+
);
224228
}
225229
},
226230
onEndReached: _chatController.loadPreviousMessages,

example/lib/rooms.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ class _RoomsPageState extends State<RoomsPage> {
198198
leading: _buildAvatar(room),
199199
title: Text(room.name ?? ''),
200200
subtitle: Text(
201-
'${timeago.format(DateTime.now().subtract(Duration(milliseconds: DateTime.now().millisecondsSinceEpoch - (room.updatedAt ?? 0))), locale: 'en_short')} ${room.lastMessages != null && room.lastMessages!.isNotEmpty && room.lastMessages!.first is types.TextMessage ? (room.lastMessages!.first as types.TextMessage).text : ''}'),
201+
'${timeago.format(DateTime.now().subtract(Duration(milliseconds: DateTime.now().millisecondsSinceEpoch - (room.updatedAt ?? 0))), locale: 'en_short')} ${room.lastMessages != null && room.lastMessages!.isNotEmpty && room.lastMessages!.first is types.TextMessage ? (room.lastMessages!.first as types.TextMessage).text : ''}',
202+
),
202203
onTap: () {
203204
Navigator.of(context).push(
204205
MaterialPageRoute(

example/pubspec.yaml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@ name: example
22
description: A new Flutter project.
33
publish_to: 'none'
44

5-
version: 1.0.0+1
5+
version: 1.1.0
66

77
environment:
8-
sdk: '>=3.4.1 <4.0.0'
8+
sdk: '>=3.4.0 <4.0.0'
99

1010
dependencies:
11-
cupertino_icons: ^1.0.6
12-
dio: ^5.4.2+1
13-
faker: ^2.1.0
14-
file_picker: ^8.0.0+1
15-
file_saver: ^0.2.12
11+
cupertino_icons: ^1.0.8
12+
dio: ^5.7.0
13+
faker: ^2.2.0
14+
file_picker: ^8.1.3
15+
file_saver: ^0.2.14
1616
flutter:
1717
sdk: flutter
1818
flutter_chat_types: ^3.6.2
19-
flutter_chat_ui: ^1.6.12
19+
flutter_chat_ui: ^1.6.15
2020
flutter_login: ^5.0.0
2121
flutter_supabase_chat_core:
2222
path: ../
2323
flutter_svg: ^2.0.10+1
24-
http: ^1.2.1
25-
image_picker: ^1.0.7
26-
mime: ^1.0.5
27-
open_filex: ^4.4.0
28-
path_provider: ^2.1.2
29-
supabase_flutter: ^2.4.0
30-
timeago: ^3.6.1
31-
uuid: ^4.3.3
24+
http: ^1.2.2
25+
image_picker: ^1.1.2
26+
mime: ^1.0.6
27+
open_filex: ^4.5.0
28+
path_provider: ^2.1.4
29+
supabase_flutter: ^2.8.0
30+
timeago: ^3.7.0
31+
uuid: ^4.5.1
3232

3333
dev_dependencies:
34-
flutter_lints: ^3.0.2
34+
flutter_lints: ^5.0.0
3535
flutter_test:
3636
sdk: flutter
3737

lib/flutter_supabase_chat_core.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
library flutter_supabase_chat_core;
1+
library;
22

33
export 'src/class/supabase_chat_controller.dart';
44
export 'src/class/supabase_chat_core.dart';

lib/src/class/supabase_chat_controller.dart

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,16 @@ class SupabaseChatController {
7070
client
7171
.channel('${config.schema}:${config.messagesTableName}:${_room.id}')
7272
.onPostgresChanges(
73-
event: PostgresChangeEvent.all,
74-
schema: config.schema,
75-
table: config.messagesTableName,
76-
filter: PostgresChangeFilter(
77-
type: PostgresChangeFilterType.eq,
78-
column: 'roomId',
79-
value: _room.id,
80-
),
81-
callback: (payload) => _onData([payload.newRecord]))
73+
event: PostgresChangeEvent.all,
74+
schema: config.schema,
75+
table: config.messagesTableName,
76+
filter: PostgresChangeFilter(
77+
type: PostgresChangeFilterType.eq,
78+
column: 'roomId',
79+
value: _room.id,
80+
),
81+
callback: (payload) => _onData([payload.newRecord]),
82+
)
8283
.subscribe();
8384
return _controller.stream;
8485
}

lib/src/class/supabase_chat_core.dart

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,11 @@ class SupabaseChatCore {
358358
client
359359
.channel('${config.schema}:${config.roomsTableName}')
360360
.onPostgresChanges(
361-
event: PostgresChangeEvent.all,
362-
schema: config.schema,
363-
table: config.roomsTableName,
364-
callback: (payload) => onData([payload.newRecord]))
361+
event: PostgresChangeEvent.all,
362+
schema: config.schema,
363+
table: config.roomsTableName,
364+
callback: (payload) => onData([payload.newRecord]),
365+
)
365366
.subscribe();
366367
return controller.stream;
367368
}
@@ -417,7 +418,9 @@ class SupabaseChatCore {
417418
.schema(config.schema)
418419
.from(config.roomsTableName)
419420
.update({'updatedAt': DateTime.now().millisecondsSinceEpoch}).eq(
420-
'id', roomId);
421+
'id',
422+
roomId,
423+
);
421424
}
422425
}
423426

@@ -448,11 +451,13 @@ class SupabaseChatCore {
448451
if (supabaseUser == null) return;
449452

450453
final roomMap = room.toJson();
451-
roomMap.removeWhere((key, value) =>
452-
key == 'createdAt' ||
453-
key == 'id' ||
454-
key == 'lastMessages' ||
455-
key == 'users');
454+
roomMap.removeWhere(
455+
(key, value) =>
456+
key == 'createdAt' ||
457+
key == 'id' ||
458+
key == 'lastMessages' ||
459+
key == 'users',
460+
);
456461

457462
if (room.type == types.RoomType.direct) {
458463
roomMap['imageUrl'] = null;
@@ -462,11 +467,13 @@ class SupabaseChatCore {
462467
roomMap['lastMessages'] = room.lastMessages?.map((m) {
463468
final messageMap = m.toJson();
464469

465-
messageMap.removeWhere((key, value) =>
466-
key == 'author' ||
467-
key == 'createdAt' ||
468-
key == 'id' ||
469-
key == 'updatedAt');
470+
messageMap.removeWhere(
471+
(key, value) =>
472+
key == 'author' ||
473+
key == 'createdAt' ||
474+
key == 'id' ||
475+
key == 'updatedAt',
476+
);
470477

471478
messageMap['authorId'] = m.author.id;
472479

lib/src/util.dart

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,17 @@ Future<List<types.Room>> processRoomsRows(
3838
String usersCollectionName,
3939
String schema,
4040
) async =>
41-
await Future.wait(rows.map(
42-
(doc) => processRoomRow(
43-
doc,
44-
supabaseUser,
45-
instance,
46-
usersCollectionName,
47-
schema,
41+
await Future.wait(
42+
rows.map(
43+
(doc) => processRoomRow(
44+
doc,
45+
supabaseUser,
46+
instance,
47+
usersCollectionName,
48+
schema,
49+
),
4850
),
49-
));
51+
);
5052

5153
/// Returns a [types.Room] created from Firebase document.
5254
Future<types.Room> processRoomRow(

0 commit comments

Comments
 (0)