mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
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
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ environment:
|
||||
|
||||
dependencies:
|
||||
cached_network_image: ^3.4.1
|
||||
collection: ^1.18.0
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_localizations:
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:shelf/shelf.dart';
|
||||
import 'package:shelf_router/shelf_router.dart';
|
||||
|
||||
@@ -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');
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user