Skip to content

Commit 2193df6

Browse files
authored
Deprecate transitiveClosure (dart-archive/collection#336)
The algorithm is implemented with a more flexible signature in `package:graphs`. See dart-lang/tools#104 Use an `ignore_for_file` rather than comment each usage of the deprecated APIs.
1 parent 112fb4d commit 2193df6

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

pkgs/collection/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- `CanonicalizedMap`: added constructor `fromEntries`.
88
- Require Dart `^3.1.0`
99
- Mark "mixin" classes as `mixin`.
10+
- Deprecate `transitiveClosure`. Consider using `package:graphs`.
1011

1112
## 1.18.0
1213

pkgs/collection/lib/src/functions.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ S? maxBy<S, T>(Iterable<S> values, T Function(S) orderBy,
120120
/// that vertex has no outgoing edges. This isn't checked, but if it's not
121121
/// satisfied, the function may crash or provide unexpected output. For example,
122122
/// `{"a": ["b"]}` is not valid, but `{"a": ["b"], "b": []}` is.
123+
@Deprecated('This method will be removed. Consider using package:graphs.')
123124
Map<T, Set<T>> transitiveClosure<T>(Map<T, Iterable<T>> graph) {
124125
// This uses [Warshall's algorithm][], modified not to add a vertex from each
125126
// node to itself.

pkgs/collection/test/functions_test.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// ignore_for_file: deprecated_member_use_from_same_package
6+
57
import 'package:collection/collection.dart';
68
import 'package:test/test.dart';
79

810
void main() {
911
group('mapMap()', () {
1012
test('with an empty map returns an empty map', () {
1113
expect(
12-
// ignore: deprecated_member_use_from_same_package
1314
mapMap({},
1415
key: expectAsync2((_, __) {}, count: 0),
1516
value: expectAsync2((_, __) {}, count: 0)),
@@ -18,7 +19,6 @@ void main() {
1819

1920
test('with no callbacks, returns a copy of the map', () {
2021
var map = {'foo': 1, 'bar': 2};
21-
// ignore: deprecated_member_use_from_same_package
2222
var result = mapMap<String, int, String, int>(map);
2323
expect(result, equals({'foo': 1, 'bar': 2}));
2424

@@ -29,23 +29,20 @@ void main() {
2929

3030
test("maps the map's keys", () {
3131
expect(
32-
// ignore: deprecated_member_use_from_same_package
3332
mapMap<String, int, dynamic, int>({'foo': 1, 'bar': 2},
3433
key: (dynamic key, dynamic value) => key[value]),
3534
equals({'o': 1, 'r': 2}));
3635
});
3736

3837
test("maps the map's values", () {
3938
expect(
40-
// ignore: deprecated_member_use_from_same_package
4139
mapMap<String, int, String, dynamic>({'foo': 1, 'bar': 2},
4240
value: (dynamic key, dynamic value) => key[value]),
4341
equals({'foo': 'o', 'bar': 'r'}));
4442
});
4543

4644
test("maps both the map's keys and values", () {
4745
expect(
48-
// ignore: deprecated_member_use_from_same_package
4946
mapMap({'foo': 1, 'bar': 2},
5047
key: (dynamic key, dynamic value) => '$key$value',
5148
value: (dynamic key, dynamic value) => key[value]),

0 commit comments

Comments
 (0)