@@ -20,17 +20,17 @@ import 'package:stack_trace/stack_trace.dart';
20
20
/// It can be a [String] or a [Uri] . If it's passed, stack frames from the SDK
21
21
/// will have `dart:` URLs.
22
22
///
23
- /// [ packageRoot] is deprecated and shouldn't be used in new code. This throws
24
- /// an [ArgumentError] if [ packageRoot] and [packageResolver] are both passed.
23
+ /// ` packageRoot` is deprecated and shouldn't be used in new code. This throws
24
+ /// an [ArgumentError] if ` packageRoot` and [packageResolver] are both passed.
25
25
StackTrace mapStackTrace (Mapping sourceMap, StackTrace stackTrace,
26
26
{bool minified = false ,
27
27
SyncPackageResolver packageResolver,
28
28
sdkRoot,
29
- @Deprecated (" Use the packageResolver parameter instead." ) packageRoot}) {
29
+ @Deprecated (' Use the packageResolver parameter instead.' ) packageRoot}) {
30
30
if (packageRoot != null ) {
31
31
if (packageResolver != null ) {
32
32
throw ArgumentError (
33
- " packageResolver and packageRoot may not both be passed." );
33
+ ' packageResolver and packageRoot may not both be passed.' );
34
34
}
35
35
36
36
packageResolver = SyncPackageResolver .root (packageRoot);
@@ -49,7 +49,7 @@ StackTrace mapStackTrace(Mapping sourceMap, StackTrace stackTrace,
49
49
throw ArgumentError ('sdkRoot must be a String or a Uri, was "$sdkRoot ".' );
50
50
}
51
51
52
- var sdkLib = sdkRoot == null ? null : " $sdkRoot /lib" ;
52
+ var sdkLib = sdkRoot == null ? null : ' $sdkRoot /lib' ;
53
53
54
54
var trace = Trace .from (stackTrace);
55
55
return Trace (trace.frames.map ((frame) {
@@ -58,7 +58,7 @@ StackTrace mapStackTrace(Mapping sourceMap, StackTrace stackTrace,
58
58
if (frame.line == null ) return null ;
59
59
60
60
// If there's no column, try using the first column of the line.
61
- var column = frame.column == null ? 0 : frame.column ;
61
+ var column = frame.column ?? 0 ;
62
62
63
63
// Subtract 1 because stack traces use 1-indexed lines and columns and
64
64
// source maps uses 0-indexed.
@@ -71,11 +71,11 @@ StackTrace mapStackTrace(Mapping sourceMap, StackTrace stackTrace,
71
71
72
72
var sourceUrl = span.sourceUrl.toString ();
73
73
if (sdkRoot != null && p.url.isWithin (sdkLib, sourceUrl)) {
74
- sourceUrl = " dart:" + p.url.relative (sourceUrl, from: sdkLib);
74
+ sourceUrl = ' dart:' + p.url.relative (sourceUrl, from: sdkLib);
75
75
} else if (packageResolver != null ) {
76
76
if (packageResolver.packageRoot != null &&
77
77
p.url.isWithin (packageResolver.packageRoot.toString (), sourceUrl)) {
78
- sourceUrl = " package:" +
78
+ sourceUrl = ' package:' +
79
79
p.url.relative (sourceUrl,
80
80
from: packageResolver.packageRoot.toString ());
81
81
} else if (packageResolver.packageConfigMap != null ) {
@@ -84,7 +84,7 @@ StackTrace mapStackTrace(Mapping sourceMap, StackTrace stackTrace,
84
84
if (! p.url.isWithin (packageUrl, sourceUrl)) continue ;
85
85
86
86
sourceUrl =
87
- " package:$package /" + p.url.relative (sourceUrl, from: packageUrl);
87
+ ' package:$package /' + p.url.relative (sourceUrl, from: packageUrl);
88
88
break ;
89
89
}
90
90
}
@@ -107,26 +107,26 @@ StackTrace mapStackTrace(Mapping sourceMap, StackTrace stackTrace,
107
107
String _prettifyMember (String member) {
108
108
return member
109
109
// Get rid of the noise that Firefox sometimes adds.
110
- .replaceAll (RegExp (r" /?<$" ), "" )
110
+ .replaceAll (RegExp (r' /?<$' ), '' )
111
111
// Get rid of arity indicators and named arguments.
112
- .replaceAll (RegExp (r" \$\d+(\$[a-zA-Z_0-9]+)*$" ), "" )
112
+ .replaceAll (RegExp (r' \$\d+(\$[a-zA-Z_0-9]+)*$' ), '' )
113
113
// Convert closures to <fn>.
114
114
.replaceAllMapped (
115
- RegExp (r" (_+)closure\d*\.call$" ),
115
+ RegExp (r' (_+)closure\d*\.call$' ),
116
116
// The number of underscores before "closure" indicates how nested it
117
117
// is.
118
- (match) => " .<fn>" * match[1 ].length)
118
+ (match) => ' .<fn>' * match[1 ].length)
119
119
// Get rid of explicitly-generated calls.
120
- .replaceAll (RegExp (r" \.call$" ), "" )
120
+ .replaceAll (RegExp (r' \.call$' ), '' )
121
121
// Get rid of the top-level method prefix.
122
- .replaceAll (RegExp (r" ^dart\." ), "" )
122
+ .replaceAll (RegExp (r' ^dart\.' ), '' )
123
123
// Get rid of library namespaces.
124
- .replaceAll (RegExp (r" [a-zA-Z_0-9]+\$" ), "" )
124
+ .replaceAll (RegExp (r' [a-zA-Z_0-9]+\$' ), '' )
125
125
// Get rid of the static method prefix. The class name also exists in the
126
126
// invocation, so we're not getting rid of any information.
127
- .replaceAll (RegExp (r" ^[a-zA-Z_0-9]+.(static|dart)." ), "" )
127
+ .replaceAll (RegExp (r' ^[a-zA-Z_0-9]+.(static|dart).' ), '' )
128
128
// Convert underscores after identifiers to dots. This runs the risk of
129
129
// incorrectly converting members that contain underscores, but those are
130
130
// contrary to the style guide anyway.
131
- .replaceAllMapped (RegExp (r" ([a-zA-Z0-9]+)_" ), (match) => match[1 ] + "." );
131
+ .replaceAllMapped (RegExp (r' ([a-zA-Z0-9]+)_' ), (match) => match[1 ] + '.' );
132
132
}
0 commit comments