File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
functions_framework_builder/lib/src Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -2,17 +2,16 @@ import 'package:analyzer/dart/element/element.dart';
2
2
import 'package:analyzer/dart/element/type.dart' ;
3
3
4
4
extension DartTypeExtension on DartType {
5
- String toStringNonNullable () {
6
- final val = getDisplayString ();
7
- if (val.endsWith ('?' )) return val.substring (0 , val.length - 1 );
8
- return val;
9
- }
5
+ String toStringNonNullable () => getDisplayString ().dropQuestion ();
10
6
}
11
7
12
8
extension ElementExtension on Element {
13
- String toStringNonNullable () {
14
- final val = getDisplayString ();
15
- if (val.endsWith ('?' )) return val.substring (0 , val.length - 1 );
16
- return val;
9
+ String toStringNonNullable () => getDisplayString ().dropQuestion ();
10
+ }
11
+
12
+ extension on String {
13
+ String dropQuestion () {
14
+ if (endsWith ('?' )) return substring (0 , length - 1 );
15
+ return this ;
17
16
}
18
17
}
You can’t perform that action at this time.
0 commit comments