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
|
||||
|
||||
3
experimental/web_dashboard/.gitignore
vendored
3
experimental/web_dashboard/.gitignore
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
3
form_app/.gitignore
vendored
3
form_app/.gitignore
vendored
@@ -31,9 +31,6 @@
|
||||
.pub/
|
||||
/build/
|
||||
|
||||
# Web related
|
||||
lib/generated_plugin_registrant.dart
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
|
||||
|
||||
3
navigation_and_routing/.gitignore
vendored
3
navigation_and_routing/.gitignore
vendored
@@ -31,9 +31,6 @@
|
||||
.pub/
|
||||
/build/
|
||||
|
||||
# Web related
|
||||
lib/generated_plugin_registrant.dart
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
3
place_tracker/.gitignore
vendored
3
place_tracker/.gitignore
vendored
@@ -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
|
||||
|
||||
@@ -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';
|
||||
@@ -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);
|
||||
|
||||
@@ -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:
|
||||
|
||||
3
simplistic_editor/.gitignore
vendored
3
simplistic_editor/.gitignore
vendored
@@ -32,9 +32,6 @@ migrate_working_dir/
|
||||
.pub/
|
||||
/build/
|
||||
|
||||
# Web related
|
||||
lib/generated_plugin_registrant.dart
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
|
||||
|
||||
Reference in New Issue
Block a user