Skip to content

Commit 9fef133

Browse files
authored
Clean up dependencies across packages (#2585)
Drop dep on pkg:collection, use new bits in Dart 3.0 Fixed very old dep in navigation_and_routing – bug was fixed long ago
1 parent 4cdd42c commit 9fef133

File tree

14 files changed

+7
-50
lines changed

14 files changed

+7
-50
lines changed

compass_app/app/lib/data/repositories/booking/booking_repository_local.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44

55
import 'dart:async';
66

7-
import 'package:collection/collection.dart';
8-
97
import '../../../domain/models/booking/booking.dart';
108
import '../../../domain/models/booking/booking_summary.dart';
119
import '../../../utils/result.dart';
12-
1310
import '../../services/local/local_data_service.dart';
1411
import 'booking_repository.dart';
1512

@@ -35,7 +32,7 @@ class BookingRepositoryLocal implements BookingRepository {
3532

3633
@override
3734
Future<Result<Booking>> getBooking(int id) async {
38-
final booking = _bookings.firstWhereOrNull((booking) => booking.id == id);
35+
final booking = _bookings.where((booking) => booking.id == id).firstOrNull;
3936
if (booking == null) {
4037
return Result.error(Exception('Booking not found'));
4138
}

compass_app/app/pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ environment:
99

1010
dependencies:
1111
cached_network_image: ^3.4.1
12-
collection: ^1.18.0
1312
flutter:
1413
sdk: flutter
1514
flutter_localizations:

compass_app/server/lib/routes/booking.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import 'dart:convert';
66

7-
import 'package:collection/collection.dart';
87
import 'package:shelf/shelf.dart';
98
import 'package:shelf_router/shelf_router.dart';
109

@@ -61,9 +60,8 @@ class BookingApi {
6160
// Get a booking by id
6261
router.get('/<id>', (Request request, String id) {
6362
final bookingId = int.parse(id);
64-
final booking = _bookings.firstWhereOrNull(
65-
(booking) => booking.id == bookingId,
66-
);
63+
final booking =
64+
_bookings.where((booking) => booking.id == bookingId).firstOrNull;
6765

6866
if (booking == null) {
6967
return Response.notFound('Invalid id');
@@ -104,9 +102,8 @@ class BookingApi {
104102
// Delete booking
105103
router.delete('/<id>', (Request request, String id) async {
106104
final bookingId = int.parse(id);
107-
final booking = _bookings.firstWhereOrNull(
108-
(booking) => booking.id == bookingId,
109-
);
105+
final booking =
106+
_bookings.where((booking) => booking.id == bookingId).firstOrNull;
110107
if (booking == null) {
111108
return Response.notFound('Invalid id');
112109
}

compass_app/server/pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ dependencies:
1212
shelf_router: ^1.1.0
1313
freezed_annotation: ^2.4.4
1414
json_annotation: ^4.9.0
15-
collection: ^1.19.0
1615

1716
dev_dependencies:
1817
http: ^1.1.0

experimental/web_dashboard/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,5 @@
3030
.pub/
3131
/build/
3232

33-
# Web related
34-
lib/generated_plugin_registrant.dart
35-
3633
# Exceptions to above rules.
3734
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

experimental/web_dashboard/pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ environment:
88

99
dependencies:
1010
cloud_firestore: ^5.0.1
11-
collection: ^1.16.0
1211
community_charts_flutter: ^1.0.2
1312
cupertino_icons: ^1.0.0
1413
firebase_auth: ^5.1.0

form_app/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
.pub/
3232
/build/
3333

34-
# Web related
35-
lib/generated_plugin_registrant.dart
36-
3734
# Symbolication related
3835
app.*.symbols
3936

navigation_and_routing/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
.pub/
3232
/build/
3333

34-
# Web related
35-
lib/generated_plugin_registrant.dart
36-
3734
# Symbolication related
3835
app.*.symbols
3936

navigation_and_routing/lib/main.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,11 @@ import 'dart:io' show Platform;
66

77
import 'package:flutter/foundation.dart' show kIsWeb;
88
import 'package:flutter/material.dart';
9-
import 'package:url_strategy/url_strategy.dart';
109
import 'package:window_size/window_size.dart';
1110

1211
import 'src/app.dart';
1312

1413
void main() {
15-
// Use package:url_strategy until this pull request is released:
16-
// https://github.com/flutter/flutter/pull/77103
17-
18-
// Use to setHashUrlStrategy() to use "/#/" in the address bar (default). Use
19-
// setPathUrlStrategy() to use the path. You may need to configure your web
20-
// server to redirect all paths to index.html.
21-
//
22-
// On mobile platforms, both functions are no-ops.
23-
setHashUrlStrategy();
24-
// setPathUrlStrategy();
25-
2614
setupWindow();
2715
runApp(const Bookstore());
2816
}

navigation_and_routing/pubspec.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@ environment:
88

99
dependencies:
1010
adaptive_navigation: ^0.0.3
11-
collection: ^1.17.0
1211
cupertino_icons: ^1.0.2
1312
flutter:
1413
sdk: flutter
1514
go_router: ^14.0.0
16-
path_to_regexp: ^0.4.0
17-
quiver: ^3.1.0
1815
url_launcher: ^6.1.1
19-
url_strategy: ^0.3.0
2016
window_size:
2117
git:
2218
url: https://github.com/google/flutter-desktop-embedding.git

place_tracker/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,3 @@
6969
!**/ios/**/default.pbxuser
7070
!**/ios/**/default.perspectivev3
7171
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
72-
73-
# Flutter Web files
74-
lib/generated_plugin_registrant.dart

place_tracker/lib/place_map.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import 'dart:async';
66
import 'dart:math';
77

8-
import 'package:collection/collection.dart';
98
import 'package:flutter/material.dart';
109
import 'package:go_router/go_router.dart';
1110
import 'package:google_maps_flutter/google_maps_flutter.dart';
@@ -279,9 +278,8 @@ class _PlaceMapState extends State<PlaceMap> {
279278
// At this point, we know the places have been updated from the list
280279
// view. We need to reconfigure the map to respect the updates.
281280
for (final place in newConfiguration.places) {
282-
final oldPlace = _configuration!.places.firstWhereOrNull(
283-
(p) => p.id == place.id,
284-
);
281+
final oldPlace =
282+
_configuration!.places.where((p) => p.id == place.id).firstOrNull;
285283
if (oldPlace == null || oldPlace != place) {
286284
// New place or updated place.
287285
_updateExistingPlaceMarker(place: place);

place_tracker/pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ dependencies:
1515
provider: ^6.0.2
1616
uuid: ^4.0.0
1717
go_router: ">=10.0.0 <15.0.0"
18-
collection: ^1.16.0
1918

2019
dev_dependencies:
2120
analysis_defaults:

simplistic_editor/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ migrate_working_dir/
3232
.pub/
3333
/build/
3434

35-
# Web related
36-
lib/generated_plugin_registrant.dart
37-
3835
# Symbolication related
3936
app.*.symbols
4037

0 commit comments

Comments
 (0)