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';
22import 'package:analyzer/dart/element/type.dart' ;
33
44extension 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 ();
106}
117
128extension 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 ;
1716 }
1817}
You can’t perform that action at this time.
0 commit comments