mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +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 'dart:async';
|
||||||
|
|
||||||
import 'package:collection/collection.dart';
|
|
||||||
|
|
||||||
import '../../../domain/models/booking/booking.dart';
|
import '../../../domain/models/booking/booking.dart';
|
||||||
import '../../../domain/models/booking/booking_summary.dart';
|
import '../../../domain/models/booking/booking_summary.dart';
|
||||||
import '../../../utils/result.dart';
|
import '../../../utils/result.dart';
|
||||||
|
|
||||||
import '../../services/local/local_data_service.dart';
|
import '../../services/local/local_data_service.dart';
|
||||||
import 'booking_repository.dart';
|
import 'booking_repository.dart';
|
||||||
|
|
||||||
@@ -35,7 +32,7 @@ class BookingRepositoryLocal implements BookingRepository {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Result<Booking>> getBooking(int id) async {
|
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) {
|
if (booking == null) {
|
||||||
return Result.error(Exception('Booking not found'));
|
return Result.error(Exception('Booking not found'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ environment:
|
|||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
cached_network_image: ^3.4.1
|
cached_network_image: ^3.4.1
|
||||||
collection: ^1.18.0
|
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:collection/collection.dart';
|
|
||||||
import 'package:shelf/shelf.dart';
|
import 'package:shelf/shelf.dart';
|
||||||
import 'package:shelf_router/shelf_router.dart';
|
import 'package:shelf_router/shelf_router.dart';
|
||||||
|
|
||||||
@@ -61,9 +60,8 @@ class BookingApi {
|
|||||||
// Get a booking by id
|
// Get a booking by id
|
||||||
router.get('/<id>', (Request request, String id) {
|
router.get('/<id>', (Request request, String id) {
|
||||||
final bookingId = int.parse(id);
|
final bookingId = int.parse(id);
|
||||||
final booking = _bookings.firstWhereOrNull(
|
final booking =
|
||||||
(booking) => booking.id == bookingId,
|
_bookings.where((booking) => booking.id == bookingId).firstOrNull;
|
||||||
);
|
|
||||||
|
|
||||||
if (booking == null) {
|
if (booking == null) {
|
||||||
return Response.notFound('Invalid id');
|
return Response.notFound('Invalid id');
|
||||||
@@ -104,9 +102,8 @@ class BookingApi {
|
|||||||
// Delete booking
|
// Delete booking
|
||||||
router.delete('/<id>', (Request request, String id) async {
|
router.delete('/<id>', (Request request, String id) async {
|
||||||
final bookingId = int.parse(id);
|
final bookingId = int.parse(id);
|
||||||
final booking = _bookings.firstWhereOrNull(
|
final booking =
|
||||||
(booking) => booking.id == bookingId,
|
_bookings.where((booking) => booking.id == bookingId).firstOrNull;
|
||||||
);
|
|
||||||
if (booking == null) {
|
if (booking == null) {
|
||||||
return Response.notFound('Invalid id');
|
return Response.notFound('Invalid id');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ dependencies:
|
|||||||
shelf_router: ^1.1.0
|
shelf_router: ^1.1.0
|
||||||
freezed_annotation: ^2.4.4
|
freezed_annotation: ^2.4.4
|
||||||
json_annotation: ^4.9.0
|
json_annotation: ^4.9.0
|
||||||
collection: ^1.19.0
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
http: ^1.1.0
|
http: ^1.1.0
|
||||||
|
|||||||
3
experimental/web_dashboard/.gitignore
vendored
3
experimental/web_dashboard/.gitignore
vendored
@@ -30,8 +30,5 @@
|
|||||||
.pub/
|
.pub/
|
||||||
/build/
|
/build/
|
||||||
|
|
||||||
# Web related
|
|
||||||
lib/generated_plugin_registrant.dart
|
|
||||||
|
|
||||||
# Exceptions to above rules.
|
# Exceptions to above rules.
|
||||||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ environment:
|
|||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
cloud_firestore: ^5.0.1
|
cloud_firestore: ^5.0.1
|
||||||
collection: ^1.16.0
|
|
||||||
community_charts_flutter: ^1.0.2
|
community_charts_flutter: ^1.0.2
|
||||||
cupertino_icons: ^1.0.0
|
cupertino_icons: ^1.0.0
|
||||||
firebase_auth: ^5.1.0
|
firebase_auth: ^5.1.0
|
||||||
|
|||||||
3
form_app/.gitignore
vendored
3
form_app/.gitignore
vendored
@@ -31,9 +31,6 @@
|
|||||||
.pub/
|
.pub/
|
||||||
/build/
|
/build/
|
||||||
|
|
||||||
# Web related
|
|
||||||
lib/generated_plugin_registrant.dart
|
|
||||||
|
|
||||||
# Symbolication related
|
# Symbolication related
|
||||||
app.*.symbols
|
app.*.symbols
|
||||||
|
|
||||||
|
|||||||
3
navigation_and_routing/.gitignore
vendored
3
navigation_and_routing/.gitignore
vendored
@@ -31,9 +31,6 @@
|
|||||||
.pub/
|
.pub/
|
||||||
/build/
|
/build/
|
||||||
|
|
||||||
# Web related
|
|
||||||
lib/generated_plugin_registrant.dart
|
|
||||||
|
|
||||||
# Symbolication related
|
# Symbolication related
|
||||||
app.*.symbols
|
app.*.symbols
|
||||||
|
|
||||||
|
|||||||
@@ -6,23 +6,11 @@ import 'dart:io' show Platform;
|
|||||||
|
|
||||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:url_strategy/url_strategy.dart';
|
|
||||||
import 'package:window_size/window_size.dart';
|
import 'package:window_size/window_size.dart';
|
||||||
|
|
||||||
import 'src/app.dart';
|
import 'src/app.dart';
|
||||||
|
|
||||||
void main() {
|
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();
|
setupWindow();
|
||||||
runApp(const Bookstore());
|
runApp(const Bookstore());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,15 +8,11 @@ environment:
|
|||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
adaptive_navigation: ^0.0.3
|
adaptive_navigation: ^0.0.3
|
||||||
collection: ^1.17.0
|
|
||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
go_router: ^14.0.0
|
go_router: ^14.0.0
|
||||||
path_to_regexp: ^0.4.0
|
|
||||||
quiver: ^3.1.0
|
|
||||||
url_launcher: ^6.1.1
|
url_launcher: ^6.1.1
|
||||||
url_strategy: ^0.3.0
|
|
||||||
window_size:
|
window_size:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/google/flutter-desktop-embedding.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.pbxuser
|
||||||
!**/ios/**/default.perspectivev3
|
!**/ios/**/default.perspectivev3
|
||||||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
!/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:async';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:collection/collection.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:google_maps_flutter/google_maps_flutter.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
|
// At this point, we know the places have been updated from the list
|
||||||
// view. We need to reconfigure the map to respect the updates.
|
// view. We need to reconfigure the map to respect the updates.
|
||||||
for (final place in newConfiguration.places) {
|
for (final place in newConfiguration.places) {
|
||||||
final oldPlace = _configuration!.places.firstWhereOrNull(
|
final oldPlace =
|
||||||
(p) => p.id == place.id,
|
_configuration!.places.where((p) => p.id == place.id).firstOrNull;
|
||||||
);
|
|
||||||
if (oldPlace == null || oldPlace != place) {
|
if (oldPlace == null || oldPlace != place) {
|
||||||
// New place or updated place.
|
// New place or updated place.
|
||||||
_updateExistingPlaceMarker(place: place);
|
_updateExistingPlaceMarker(place: place);
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ dependencies:
|
|||||||
provider: ^6.0.2
|
provider: ^6.0.2
|
||||||
uuid: ^4.0.0
|
uuid: ^4.0.0
|
||||||
go_router: ">=10.0.0 <15.0.0"
|
go_router: ">=10.0.0 <15.0.0"
|
||||||
collection: ^1.16.0
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
analysis_defaults:
|
analysis_defaults:
|
||||||
|
|||||||
3
simplistic_editor/.gitignore
vendored
3
simplistic_editor/.gitignore
vendored
@@ -32,9 +32,6 @@ migrate_working_dir/
|
|||||||
.pub/
|
.pub/
|
||||||
/build/
|
/build/
|
||||||
|
|
||||||
# Web related
|
|
||||||
lib/generated_plugin_registrant.dart
|
|
||||||
|
|
||||||
# Symbolication related
|
# Symbolication related
|
||||||
app.*.symbols
|
app.*.symbols
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user