@@ -20,17 +20,17 @@ import 'package:stack_trace/stack_trace.dart';
2020/// It can be a [String] or a [Uri] . If it's passed, stack frames from the SDK
2121/// will have `dart:` URLs.
2222///
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.
2525StackTrace mapStackTrace (Mapping sourceMap, StackTrace stackTrace,
2626 {bool minified = false ,
2727 SyncPackageResolver packageResolver,
2828 sdkRoot,
29- @Deprecated (" Use the packageResolver parameter instead." ) packageRoot}) {
29+ @Deprecated (' Use the packageResolver parameter instead.' ) packageRoot}) {
3030 if (packageRoot != null ) {
3131 if (packageResolver != null ) {
3232 throw ArgumentError (
33- " packageResolver and packageRoot may not both be passed." );
33+ ' packageResolver and packageRoot may not both be passed.' );
3434 }
3535
3636 packageResolver = SyncPackageResolver .root (packageRoot);
@@ -49,7 +49,7 @@ StackTrace mapStackTrace(Mapping sourceMap, StackTrace stackTrace,
4949 throw ArgumentError ('sdkRoot must be a String or a Uri, was "$sdkRoot ".' );
5050 }
5151
52- var sdkLib = sdkRoot == null ? null : " $sdkRoot /lib" ;
52+ var sdkLib = sdkRoot == null ? null : ' $sdkRoot /lib' ;
5353
5454 var trace = Trace .from (stackTrace);
5555 return Trace (trace.frames.map ((frame) {
@@ -58,7 +58,7 @@ StackTrace mapStackTrace(Mapping sourceMap, StackTrace stackTrace,
5858 if (frame.line == null ) return null ;
5959
6060 // 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 ;
6262
6363 // Subtract 1 because stack traces use 1-indexed lines and columns and
6464 // source maps uses 0-indexed.
@@ -71,11 +71,11 @@ StackTrace mapStackTrace(Mapping sourceMap, StackTrace stackTrace,
7171
7272 var sourceUrl = span.sourceUrl.toString ();
7373 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);
7575 } else if (packageResolver != null ) {
7676 if (packageResolver.packageRoot != null &&
7777 p.url.isWithin (packageResolver.packageRoot.toString (), sourceUrl)) {
78- sourceUrl = " package:" +
78+ sourceUrl = ' package:' +
7979 p.url.relative (sourceUrl,
8080 from: packageResolver.packageRoot.toString ());
8181 } else if (packageResolver.packageConfigMap != null ) {
@@ -84,7 +84,7 @@ StackTrace mapStackTrace(Mapping sourceMap, StackTrace stackTrace,
8484 if (! p.url.isWithin (packageUrl, sourceUrl)) continue ;
8585
8686 sourceUrl =
87- " package:$package /" + p.url.relative (sourceUrl, from: packageUrl);
87+ ' package:$package /' + p.url.relative (sourceUrl, from: packageUrl);
8888 break ;
8989 }
9090 }
@@ -107,26 +107,26 @@ StackTrace mapStackTrace(Mapping sourceMap, StackTrace stackTrace,
107107String _prettifyMember (String member) {
108108 return member
109109 // Get rid of the noise that Firefox sometimes adds.
110- .replaceAll (RegExp (r" /?<$" ), "" )
110+ .replaceAll (RegExp (r' /?<$' ), '' )
111111 // 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]+)*$' ), '' )
113113 // Convert closures to <fn>.
114114 .replaceAllMapped (
115- RegExp (r" (_+)closure\d*\.call$" ),
115+ RegExp (r' (_+)closure\d*\.call$' ),
116116 // The number of underscores before "closure" indicates how nested it
117117 // is.
118- (match) => " .<fn>" * match[1 ].length)
118+ (match) => ' .<fn>' * match[1 ].length)
119119 // Get rid of explicitly-generated calls.
120- .replaceAll (RegExp (r" \.call$" ), "" )
120+ .replaceAll (RegExp (r' \.call$' ), '' )
121121 // Get rid of the top-level method prefix.
122- .replaceAll (RegExp (r" ^dart\." ), "" )
122+ .replaceAll (RegExp (r' ^dart\.' ), '' )
123123 // Get rid of library namespaces.
124- .replaceAll (RegExp (r" [a-zA-Z_0-9]+\$" ), "" )
124+ .replaceAll (RegExp (r' [a-zA-Z_0-9]+\$' ), '' )
125125 // Get rid of the static method prefix. The class name also exists in the
126126 // 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).' ), '' )
128128 // Convert underscores after identifiers to dots. This runs the risk of
129129 // incorrectly converting members that contain underscores, but those are
130130 // 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 ] + '.' );
132132}
0 commit comments