Skip to content

Commit d9d502a

Browse files
nateboschdavidmorgan
authored andcommitted
Drop dependency on quiver
The package had been used for only two utilities, `concat` and `zip`. Replace `zip` with `IterableZip` from `package:collection` which is also an existing dependency. Replace `concat` with either `...` elements in a list literal (since the collections are always iterated anyway) or by replacing `.map` with `.expand`.
1 parent c4787d9 commit d9d502a

File tree

4 files changed

+33
-35
lines changed

4 files changed

+33
-35
lines changed

built_value_generator/lib/src/enum_source_class.dart

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import 'package:built_value_generator/src/enum_source_field.dart';
1414
import 'package:built_value_generator/src/strings.dart';
1515
import 'package:collection/collection.dart'
1616
show IterableExtension, IterableNullableExtension;
17-
import 'package:quiver/iterables.dart';
1817

1918
part 'enum_source_class.g.dart';
2019

@@ -102,10 +101,11 @@ abstract class EnumSourceClass
102101

103102
@memoized
104103
Iterable<String> get identifiers {
105-
return concat([
106-
<String?>[valuesIdentifier, valueOfIdentifier],
107-
fields.map<String?>((field) => field.generatedIdentifier)
108-
]).whereNotNull().toList();
104+
return [
105+
valuesIdentifier,
106+
valueOfIdentifier,
107+
for (var field in fields) field.generatedIdentifier,
108+
].whereNotNull().toList();
109109
}
110110

111111
static bool needsEnumClass(ClassElement classElement) {
@@ -114,23 +114,23 @@ abstract class EnumSourceClass
114114
}
115115

116116
Iterable<String> computeErrors() {
117-
return concat([
118-
_checkAbstract(),
119-
_checkFields(),
120-
_checkFallbackFields(),
121-
_checkConstructor(),
122-
_checkValuesGetter(),
123-
_checkValueOf(),
124-
_checkMixin(),
125-
]).toList();
117+
return [
118+
..._checkAbstract(),
119+
..._checkFields(),
120+
..._checkFallbackFields(),
121+
..._checkConstructor(),
122+
..._checkValuesGetter(),
123+
..._checkValueOf(),
124+
..._checkMixin(),
125+
];
126126
}
127127

128128
Iterable<String> _checkAbstract() {
129129
return isAbstract ? ['Make $name concrete; remove "abstract".'] : [];
130130
}
131131

132132
Iterable<String> _checkFields() {
133-
return concat(fields.map((field) => field.errors));
133+
return fields.expand((field) => field.errors);
134134
}
135135

136136
Iterable<String> _checkFallbackFields() {

built_value_generator/lib/src/enum_source_library.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import 'package:built_value/built_value.dart';
1111
import 'package:built_value_generator/src/analyzer.dart';
1212
import 'package:built_value_generator/src/enum_source_class.dart';
1313
import 'package:built_value_generator/src/library_elements.dart';
14-
import 'package:quiver/iterables.dart';
1514
import 'package:source_gen/source_gen.dart';
1615

1716
part 'enum_source_library.g.dart';
@@ -59,11 +58,11 @@ abstract class EnumSourceLibrary
5958
}
6059

6160
Iterable<String> _computeErrors() {
62-
return concat([
63-
_checkPart(),
64-
_checkIdentifiers(),
65-
concat(classes.map((c) => c.computeErrors()))
66-
]);
61+
return [
62+
..._checkPart(),
63+
..._checkIdentifiers(),
64+
for (var c in classes) ...c.computeErrors(),
65+
];
6766
}
6867

6968
Iterable<String> _checkPart() {

built_value_generator/lib/src/value_source_class.dart

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import 'package:built_value_generator/src/memoized_getter.dart';
1717
import 'package:built_value_generator/src/metadata.dart';
1818
import 'package:built_value_generator/src/strings.dart';
1919
import 'package:built_value_generator/src/value_source_field.dart';
20-
import 'package:quiver/iterables.dart';
20+
import 'package:collection/collection.dart';
2121
import 'package:source_gen/source_gen.dart';
2222

2323
import 'dart_types.dart';
@@ -384,14 +384,14 @@ abstract class ValueSourceClass
384384
}
385385

386386
Iterable<GeneratorError> computeErrors() {
387-
return concat([
388-
_checkPart(),
389-
_checkSettings(),
390-
_checkValueClass(),
391-
_checkBuilderClass(),
392-
_checkFieldList(),
393-
concat(fields.map((field) => field.computeErrors()))
394-
]);
387+
return [
388+
..._checkPart(),
389+
..._checkSettings(),
390+
..._checkValueClass(),
391+
..._checkBuilderClass(),
392+
..._checkFieldList(),
393+
for (var field in fields) ...field.computeErrors()
394+
];
395395
}
396396

397397
Iterable<GeneratorError> _checkPart() {
@@ -719,9 +719,9 @@ abstract class ValueSourceClass
719719
String get _boundedGenerics => genericParameters.isEmpty
720720
? ''
721721
: '<' +
722-
zip(<Iterable>[genericParameters, genericBounds]).map((zipped) {
723-
final parameter = zipped[0] as String;
724-
final bound = zipped[1] as String;
722+
IterableZip([genericParameters, genericBounds]).map((zipped) {
723+
final parameter = zipped[0];
724+
final bound = zipped[1];
725725
return bound.isEmpty ? parameter : '$parameter extends $bound';
726726
}).join(', ') +
727727
'>';

built_value_generator/pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: built_value_generator
2-
version: 8.4.2
2+
version: 8.4.3-dev
33
description: >
44
Value types with builders, Dart classes as enums, and serialization.
55
This library is the dev dependency.
@@ -16,7 +16,6 @@ dependencies:
1616
built_value: '>=8.1.0 <8.5.0'
1717
collection: ^1.15.0
1818
source_gen: '>=0.9.0 <2.0.0'
19-
quiver: '>=0.21.0 <4.0.0'
2019

2120
dev_dependencies:
2221
build_test: '>=1.2.0 <3.0.0'

0 commit comments

Comments
 (0)