File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,12 @@ import 'package:yaml/yaml.dart';
4
4
class Flutter {
5
5
Flutter (YamlMap flutterMap) {
6
6
if (flutterMap != null ) {
7
- assets = FlutterAssets (safeCast <YamlList >(flutterMap['assets' ]));
8
- fonts = FlutterFonts (safeCast <YamlList >(flutterMap['fonts' ]));
7
+ if (flutterMap.containsKey ('assets' )) {
8
+ assets = FlutterAssets (safeCast <YamlList >(flutterMap['assets' ]));
9
+ }
10
+ if (flutterMap.containsKey ('fonts' )) {
11
+ fonts = FlutterFonts (safeCast <YamlList >(flutterMap['fonts' ]));
12
+ }
9
13
}
10
14
}
11
15
Original file line number Diff line number Diff line change @@ -8,10 +8,14 @@ class FlutterGen {
8
8
FlutterGen (YamlMap flutterGenMap) {
9
9
if (flutterGenMap != null ) {
10
10
_output = safeCast <String >(flutterGenMap['output' ]);
11
- integrations = FlutterGenIntegrations (
11
+ if (flutterGenMap.containsKey ('integrations' )) {
12
+ integrations = FlutterGenIntegrations (
12
13
safeCast <YamlMap >(flutterGenMap['integrations' ]));
14
+ }
13
15
_lineLength = safeCast <int >(flutterGenMap['lineLength' ]);
14
- colors = FlutterGenColors (safeCast <YamlMap >(flutterGenMap['colors' ]));
16
+ if (flutterGenMap.containsKey ('colors' )) {
17
+ colors = FlutterGenColors (safeCast <YamlMap >(flutterGenMap['colors' ]));
18
+ }
15
19
}
16
20
}
17
21
Original file line number Diff line number Diff line change @@ -146,6 +146,14 @@ void main() {
146
146
});
147
147
148
148
test ('Assets with No inegrations on pubspec.yaml' , () async {
149
+ await FlutterGenerator (
150
+ File ('test_resources/pubspec_assets_no_integrations.yaml' ))
151
+ .build ();
152
+ expect (
153
+ File ('test_resources/lib/gen/assets.gen.dart' ).readAsStringSync (),
154
+ isNotEmpty,
155
+ );
156
+
149
157
final pubspec = File ('test_resources/pubspec_assets_no_integrations.yaml' );
150
158
final config = await Config (pubspec).load ();
151
159
final formatter = DartFormatter (pageWidth: config.flutterGen.lineLength);
You can’t perform that action at this time.
0 commit comments