Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 7a03761

Browse files
author
Olivier Chafik
committed
Leave less implicit dynamics
Used dart-archive/linter#262 to spot these
1 parent c2bdcca commit 7a03761

File tree

10 files changed

+20
-15
lines changed

10 files changed

+20
-15
lines changed

lib/reloader/reloader.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ import 'dart:async';
2121
///
2222
/// Note that calls to this function and imports of this file are
2323
/// removed by `scissors/reloader/transformer` in release mode.
24-
setupReloader(
25-
{timestampBaseUrl: '/', delay: const Duration(seconds: 1)}) async {
24+
Future setupReloader(
25+
{String timestampBaseUrl: '/',
26+
Duration delay: const Duration(seconds: 1)}) async {
2627
var initialTimestamp = await _getTimestamp(timestampBaseUrl);
2728
await Future.doWhile(() async {
2829
await new Future.delayed(const Duration(seconds: 1));
@@ -39,7 +40,7 @@ setupReloader(
3940
});
4041
}
4142

42-
Future<int> _getTimestamp(timestampBaseUrl) {
43+
Future<int> _getTimestamp(String timestampBaseUrl) {
4344
var completer = new Completer<int>();
4445
new HttpRequest()
4546
..open('GET', timestampBaseUrl + 'timestamp')

lib/src/css_mirroring/entity.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ int _getNodeStart(TreeNode node) {
5353
return node.span.start.offset;
5454
}
5555

56-
int getDeclarationEnd(String source, List decls, int iDecl) {
56+
int getDeclarationEnd/*<T extends TreeNode>*/(
57+
String source, List/*<T>*/ decls, int iDecl) {
5758
if (iDecl < decls.length - 1) {
5859
return decls[iDecl + 1].span.start.offset;
5960
}

lib/src/css_pruning/ng_class_parser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ NgClassParsingResults parseNgClassAttribute(String attributeValue) {
8383
return new NgClassParsingResults(hasVariableClasses, classes);
8484
}
8585

86-
_trimmer(s) => s.trim();
86+
String _trimmer(String s) => s.trim();

lib/src/css_pruning/usage_collector.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class UsageCollector extends dom_parsing.TreeVisitor {
5555
desc.classFragments.add(pattern);
5656
}
5757
}
58-
for (var name in node.attributes.keys) {
58+
for (dynamic name in node.attributes.keys) {
5959
if (name is! String) continue;
6060

6161
var m = _ng2ClassNameAttrRx.matchAsPrefix(name);

lib/src/image_inlining/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ main(List<String> args) async {
5454
await stream.pipe(output.openWrite());
5555
}
5656

57-
makeFileAsset(File file) {
57+
Asset makeFileAsset(File file) {
5858
var path = relative(file.path, from: Directory.current.path);
5959
return new Asset.fromFile(new AssetId(_package, path), new File(path));
6060
}
6161

62-
makeStringAsset(String path, String input) {
62+
Asset makeStringAsset(String path, String input) {
6363
return new Asset.fromString(new AssetId(_package, path), input);
6464
}
6565

lib/src/parts_check/transformer.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class PartsCheckTransformer extends Transformer
4242
bool isPrimary(AssetId id) =>
4343
expectedPartCounts.isNotEmpty && super.isPrimary(id);
4444

45-
get expectedPartCounts => _settings.expectedPartCounts.value;
45+
Map<String, int> get expectedPartCounts =>
46+
_settings.expectedPartCounts.value as Map<String, int>;
4647

4748
@override
4849
apply(Transform transform) async {

lib/src/permutations/transformer.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ class PermutationsTransformer extends AggregateTransformer
103103
var map = new IntlDeferredMap.fromJson(deferredMapJson);
104104

105105
var defaultLocale = _settings.defaultLocale.value;
106-
var allLocales = []..addAll(map.locales);
106+
var allLocales = <String>[]..addAll(map.locales);
107107
if (defaultLocale != null) allLocales.add(defaultLocale);
108108

109109
if (_settings.verbose.value) {
110110
transform.logger.info('Found entry points ${map.mainNames}, '
111111
'and locales ${map.locales} with default locale $defaultLocale');
112112
}
113113

114-
Asset getMatchingAsset(path, {throwIfNotFound: true}) =>
114+
Asset getMatchingAsset(String path, {throwIfNotFound: true}) =>
115115
inputs.firstWhere((a) => a.id.path.endsWith(path), orElse: () {
116116
if (!throwIfNotFound) return null;
117117

lib/src/utils/process_utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ String which(String path) => successString('which $path', _which(path)).trim();
3838

3939
bool hasExecutable(String name) => _which(name).exitCode == 0;
4040

41-
Future<ProcessResult> pipeInAndOutOfNewProcess(Process p, input) async {
41+
Future<ProcessResult> pipeInAndOutOfNewProcess(Process p, dynamic input) async {
4242
if (input is String) {
4343
p.stdin.write(input);
4444
} else if (input is List<int>) {

lib/src/utils/setting.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Setting<T> {
4444
if (value == null) {
4545
_value = isDebug ? debugDefault : releaseDefault;
4646
} else {
47-
_value = parser != null ? parser(value) : value as T;
47+
_value = parser != null ? parser('$value') : value as T;
4848
}
4949
}
5050
}

lib/src/utils/settings_base.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ abstract class SettingsBase {
5757
static const _releaseConfigKey = 'release';
5858

5959
SettingsBase(this._settings) {
60-
var config = _settings.configuration;
61-
config.addAll(config[isDebug ? _debugConfigKey : _releaseConfigKey] ?? {});
60+
var config = _settings.configuration as Map<String, dynamic>;
61+
config.addAll(config[isDebug ? _debugConfigKey : _releaseConfigKey]
62+
as Map<String, dynamic> ??
63+
const <String, dynamic>{});
6264

6365
var settingList = getAllSettings();
6466
var validKeys = []

0 commit comments

Comments
 (0)