-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Request extends http.BaseRequest (#370)
- Loading branch information
Showing
14 changed files
with
561 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
extension StripStringExtension on String { | ||
/// The string without any leading whitespace and optional [character] | ||
String leftStrip([String? character]) { | ||
final String trimmed = trimLeft(); | ||
|
||
if (character != null && trimmed.startsWith(character)) { | ||
return trimmed.substring(1); | ||
} | ||
|
||
return trimmed; | ||
} | ||
|
||
/// The string without any trailing whitespace and optional [character] | ||
String rightStrip([String? character]) { | ||
final String trimmed = trimRight(); | ||
|
||
if (character != null && trimmed.endsWith(character)) { | ||
return trimmed.substring(0, trimmed.length - 1); | ||
} | ||
|
||
return trimmed; | ||
} | ||
|
||
/// The string without any leading and trailing whitespace and optional [character] | ||
String strip([String? character]) => | ||
character != null ? leftStrip(character).rightStrip(character) : trim(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.