File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,10 @@ class RecordElementTypeRendererHtml
124
124
.renderLinkedFields (elementType)
125
125
.trim ())
126
126
..write (')' );
127
- return wrapNullabilityParens (elementType, buffer.toString ());
127
+ if (elementType.nullabilitySuffix.isNotEmpty) {
128
+ buffer.write (elementType.nullabilitySuffix);
129
+ }
130
+ return buffer.toString ();
128
131
}
129
132
130
133
@override
Original file line number Diff line number Diff line change @@ -34,6 +34,24 @@ void f(() r) {}
34
34
expect (recordType.nameWithGenerics, equals ('Record' ));
35
35
}
36
36
37
+ void test_nullableReturn () async {
38
+ var library = await bootPackageWithLibrary ('''
39
+ (int)? f() {}
40
+ ''' );
41
+ var fFunction = library.functions.named ('f' );
42
+ var recordType = fFunction.modelType.returnType;
43
+ expect (recordType.linkedName, matchesCompressed (r'''
44
+ \(
45
+ <span class="field">
46
+ <span class="type-annotation">
47
+ <a href=".*/dart-core/int-class.html">int</a>
48
+ </span>
49
+ </span>
50
+ \)?
51
+ ''' ));
52
+ expect (recordType.nameWithGenerics, equals ('Record?' ));
53
+ }
54
+
37
55
void test_onePositionalField () async {
38
56
var library = await bootPackageWithLibrary ('''
39
57
void f((int) r) {}
You can’t perform that action at this time.
0 commit comments