Skip to content

Commit 721a532

Browse files
committed
fix template
1 parent 4ad9f8d commit 721a532

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'package:flutter/foundation.dart';
1+
import 'exception.dart';
22

33
class InputFile {
44
late final String? path;
@@ -9,10 +9,8 @@ class InputFile {
99
/// Provide a file, use `path` for IO platforms
1010
/// and provide `bytes` for web platform
1111
InputFile({this.path, this.filename, this.contentType, this.bytes}) {
12-
if (kIsWeb && bytes == null) {
13-
throw {{ spec.title | caseUcfirst }}Exception('On web `bytes` is required');
14-
} else if(!kIsWeb && path == null && bytes == null) {
15-
throw {{ spec.title | caseUcfirst }}Exception('On IO platforms one of `path` or `bytes` is required`);
12+
if (path == null && bytes == null) {
13+
throw {{ spec.title | caseUcfirst }}Exception('One of `path` or `bytes` is required');
1614
}
1715
}
1816
}

templates/flutter/lib/src/input_file.dart.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/foundation.dart';
2+
import 'exception.dart';
23

34
class InputFile {
45
late final String? path;
@@ -12,7 +13,7 @@ class InputFile {
1213
if (kIsWeb && bytes == null) {
1314
throw {{ spec.title | caseUcfirst }}Exception('On web `bytes` is required');
1415
} else if(!kIsWeb && path == null && bytes == null) {
15-
throw {{ spec.title | caseUcfirst }}Exception('On IO platforms one of `path` or `bytes` is required`);
16+
throw {{ spec.title | caseUcfirst }}Exception('On IO platforms one of `path` or `bytes` is required');
1617
}
1718
}
1819
}

0 commit comments

Comments
 (0)