@@ -380,22 +380,31 @@ class Primitives {
380
380
}
381
381
382
382
static bool ? parseBool (String source, bool caseSensitive) {
383
- checkNotNullable (source, "source" );
383
+ checkNotNullable (source, "source" );
384
+ checkNotNullable (caseSensitive, "caseSensitive" );
384
385
//The caseSensitive defaults to true.
385
- if (caseSensitive == null || caseSensitive == true )
386
- return source == "true" ? true : source == "false" ? false : null ;
387
- //Ignore case-sensitive when caseSensitive is false.
388
- return _compareIgnoreCase (source, "true" )? true : _compareIgnoreCase (source, "false" )? false : null ;
386
+ if (caseSensitive == null || caseSensitive == true )
387
+ return source == "true"
388
+ ? true
389
+ : source == "false"
390
+ ? false
391
+ : null ;
392
+ //Ignore case-sensitive when caseSensitive is false.
393
+ return _compareIgnoreCase (source, "true" )
394
+ ? true
395
+ : _compareIgnoreCase (source, "false" )
396
+ ? false
397
+ : null ;
389
398
}
390
399
391
400
static bool _compareIgnoreCase (String input, String lowerCaseTarget) {
392
- if (input.length != lowerCaseTarget.length) return false ;
393
- for (var i = 0 ; i < input.length; i++ ) {
394
- if (input.codeUnitAt (i) | 0x20 != lowerCaseTarget.codeUnitAt (i)) {
395
- return false ;
396
- }
397
- }
398
- return true ;
401
+ if (input.length != lowerCaseTarget.length) return false ;
402
+ for (var i = 0 ; i < input.length; i++ ) {
403
+ if (input.codeUnitAt (i) | 0x20 != lowerCaseTarget.codeUnitAt (i)) {
404
+ return false ;
405
+ }
406
+ }
407
+ return true ;
399
408
}
400
409
401
410
/// [: r"$".codeUnitAt(0) :]
0 commit comments