-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b26e316
commit 099b59f
Showing
5 changed files
with
40 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: MAIN CI | ||
name: Main CI | ||
|
||
on: | ||
push: | ||
|
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,15 @@ | ||
extension HelperExtensionInt on int { | ||
/// Function to convert a int to a List. | ||
/// | ||
///```dart | ||
/// final list = 3.toList(); | ||
/// print(list); // [0, 1, 2] | ||
///``` | ||
List<int> toList() { | ||
final list = List<int>.empty(growable: true); | ||
for (int i = 0; i < this; i++) { | ||
list.add(i); | ||
} | ||
return list; | ||
} | ||
} |
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,18 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:helper_extension/src/helper_extension_int.dart'; | ||
|
||
void main() { | ||
group('Test toList', () { | ||
test('Function return []', () { | ||
expect(0.toList(), []); | ||
}); | ||
|
||
test('Function return [0]', () { | ||
expect(1.toList(), [0]); | ||
}); | ||
|
||
test('Function return [0, 1, 2]', () { | ||
expect(3.toList(), [0, 1, 2]); | ||
}); | ||
}); | ||
} |