Skip to content

Commit

Permalink
Clean up dependencies across packages (#2585)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kevmoo authored Feb 13, 2025
1 parent 4cdd42c commit 9fef133
Show file tree
Hide file tree
Showing 14 changed files with 7 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@

import 'dart:async';

import 'package:collection/collection.dart';

import '../../../domain/models/booking/booking.dart';
import '../../../domain/models/booking/booking_summary.dart';
import '../../../utils/result.dart';

import '../../services/local/local_data_service.dart';
import 'booking_repository.dart';

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

@override
Future<Result<Booking>> getBooking(int id) async {
final booking = _bookings.firstWhereOrNull((booking) => booking.id == id);
final booking = _bookings.where((booking) => booking.id == id).firstOrNull;
if (booking == null) {
return Result.error(Exception('Booking not found'));
}
Expand Down
1 change: 0 additions & 1 deletion compass_app/app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ environment:

dependencies:
cached_network_image: ^3.4.1
collection: ^1.18.0
flutter:
sdk: flutter
flutter_localizations:
Expand Down
11 changes: 4 additions & 7 deletions compass_app/server/lib/routes/booking.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import 'dart:convert';

import 'package:collection/collection.dart';
import 'package:shelf/shelf.dart';
import 'package:shelf_router/shelf_router.dart';

Expand Down Expand Up @@ -61,9 +60,8 @@ class BookingApi {
// Get a booking by id
router.get('/<id>', (Request request, String id) {
final bookingId = int.parse(id);
final booking = _bookings.firstWhereOrNull(
(booking) => booking.id == bookingId,
);
final booking =
_bookings.where((booking) => booking.id == bookingId).firstOrNull;

if (booking == null) {
return Response.notFound('Invalid id');
Expand Down Expand Up @@ -104,9 +102,8 @@ class BookingApi {
// Delete booking
router.delete('/<id>', (Request request, String id) async {
final bookingId = int.parse(id);
final booking = _bookings.firstWhereOrNull(
(booking) => booking.id == bookingId,
);
final booking =
_bookings.where((booking) => booking.id == bookingId).firstOrNull;
if (booking == null) {
return Response.notFound('Invalid id');
}
Expand Down
1 change: 0 additions & 1 deletion compass_app/server/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies:
shelf_router: ^1.1.0
freezed_annotation: ^2.4.4
json_annotation: ^4.9.0
collection: ^1.19.0

dev_dependencies:
http: ^1.1.0
Expand Down
3 changes: 0 additions & 3 deletions experimental/web_dashboard/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,5 @@
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
1 change: 0 additions & 1 deletion experimental/web_dashboard/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ environment:

dependencies:
cloud_firestore: ^5.0.1
collection: ^1.16.0
community_charts_flutter: ^1.0.2
cupertino_icons: ^1.0.0
firebase_auth: ^5.1.0
Expand Down
3 changes: 0 additions & 3 deletions form_app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

Expand Down
3 changes: 0 additions & 3 deletions navigation_and_routing/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

Expand Down
12 changes: 0 additions & 12 deletions navigation_and_routing/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,11 @@ import 'dart:io' show Platform;

import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/material.dart';
import 'package:url_strategy/url_strategy.dart';
import 'package:window_size/window_size.dart';

import 'src/app.dart';

void main() {
// Use package:url_strategy until this pull request is released:
// https://github.com/flutter/flutter/pull/77103

// Use to setHashUrlStrategy() to use "/#/" in the address bar (default). Use
// setPathUrlStrategy() to use the path. You may need to configure your web
// server to redirect all paths to index.html.
//
// On mobile platforms, both functions are no-ops.
setHashUrlStrategy();
// setPathUrlStrategy();

setupWindow();
runApp(const Bookstore());
}
Expand Down
4 changes: 0 additions & 4 deletions navigation_and_routing/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ environment:

dependencies:
adaptive_navigation: ^0.0.3
collection: ^1.17.0
cupertino_icons: ^1.0.2
flutter:
sdk: flutter
go_router: ^14.0.0
path_to_regexp: ^0.4.0
quiver: ^3.1.0
url_launcher: ^6.1.1
url_strategy: ^0.3.0
window_size:
git:
url: https://github.com/google/flutter-desktop-embedding.git
Expand Down
3 changes: 0 additions & 3 deletions place_tracker/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,3 @@
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

# Flutter Web files
lib/generated_plugin_registrant.dart
6 changes: 2 additions & 4 deletions place_tracker/lib/place_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import 'dart:async';
import 'dart:math';

import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
Expand Down Expand Up @@ -279,9 +278,8 @@ class _PlaceMapState extends State<PlaceMap> {
// At this point, we know the places have been updated from the list
// view. We need to reconfigure the map to respect the updates.
for (final place in newConfiguration.places) {
final oldPlace = _configuration!.places.firstWhereOrNull(
(p) => p.id == place.id,
);
final oldPlace =
_configuration!.places.where((p) => p.id == place.id).firstOrNull;
if (oldPlace == null || oldPlace != place) {
// New place or updated place.
_updateExistingPlaceMarker(place: place);
Expand Down
1 change: 0 additions & 1 deletion place_tracker/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies:
provider: ^6.0.2
uuid: ^4.0.0
go_router: ">=10.0.0 <15.0.0"
collection: ^1.16.0

dev_dependencies:
analysis_defaults:
Expand Down
3 changes: 0 additions & 3 deletions simplistic_editor/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ migrate_working_dir/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

Expand Down

0 comments on commit 9fef133

Please sign in to comment.