Skip to content

Commit

Permalink
add nullable of File type @part (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
htetaunglin authored Oct 28, 2024
1 parent 3995722 commit 7ece164
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions generator/lib/src/generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1867,6 +1867,9 @@ ${bodyName.displayName} == null
final contentType = r.peek('contentType')?.stringValue;

if (isFileField) {
if (p.type.isNullable) {
blocks.add(Code('if (${p.displayName} != null){'));
}
final fileNameValue = r.peek('fileName')?.stringValue;
final fileName = fileNameValue != null
? literalString(fileNameValue)
Expand Down Expand Up @@ -1907,6 +1910,9 @@ ${bodyName.displayName} == null
} else {
blocks.add(returnCode);
}
if (p.type.isNullable) {
blocks.add(Code('}'));
}
} else if (_displayString(p.type) == 'List<int>') {
final optionalFile = m.parameters
.firstWhereOrNull((pp) => pp.displayName == p.displayName)
Expand Down

0 comments on commit 7ece164

Please sign in to comment.