diff --git a/lib/src/string.dart b/lib/src/string.dart index e39ff20..4fafc88 100644 --- a/lib/src/string.dart +++ b/lib/src/string.dart @@ -189,7 +189,7 @@ extension StringX on String { /// Returns a new substring containing all characters between [start] /// (inclusive) and [end] (inclusive). /// If [end] is omitted, it is being set to `lastIndex`. - /// + /// /// ```dart /// print('awesomeString'.slice(0,6)); // awesome /// print('awesomeString'.slice(7)); // String diff --git a/test/string_test.dart b/test/string_test.dart index c3051d4..7a83aba 100644 --- a/test/string_test.dart +++ b/test/string_test.dart @@ -197,19 +197,19 @@ void main() { ); }); - test('.slice()', (){ - expect('awesomeString'.slice(0,6), 'awesome'); - expect('awesomeString'.slice(0,-7), 'awesome'); + test('.slice()', () { + expect('awesomeString'.slice(0, 6), 'awesome'); + expect('awesomeString'.slice(0, -7), 'awesome'); expect('awesomeString'.slice(7), 'String'); expect('awesomeString'.slice(-6), 'String'); expect('awesomeString'.slice(-6, -1), 'String'); - expect('awesomeString'.slice(-6,8), 'St'); + expect('awesomeString'.slice(-6, 8), 'St'); expect('awesomeString'.slice(0), 'awesomeString'); - + expect(() => ''.slice(0), throwsRangeError); - expect(() => ''.slice(0,1), throwsRangeError); + expect(() => ''.slice(0, 1), throwsRangeError); expect(() => ''.slice(-1), throwsRangeError); - expect(() => ''.slice(0,-1), throwsRangeError); + expect(() => ''.slice(0, -1), throwsRangeError); expect(() => 'awesomeString'.slice(1, 13), throwsRangeError); expect(() => 'awesomeString'.slice(2, 1), throwsRangeError); expect(() => 'awesomeString'.slice(13), throwsRangeError);