In diesem Beispiel ist d also der Logarithmus aus 8 zur Basis 2, also d=log_2
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
List<int> mergeSort(List<int> array) { | |
// Stop recursion if array contains only one element | |
if(array.length <= 1) { | |
return array; | |
} | |
// split in the middle of the array | |
int splitIndex = array.length ~/ 2; |
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
name | age | |
---|---|---|
Ellen Butler | 50 | |
Richard Ford | 42 | |
Michael Reeves | 19 | |
Leonard Freeman | 53 | |
Hester Reyes | 58 | |
Bobby Campbell | 37 | |
Inez Holland | 32 | |
Garrett Willis | 37 | |
123 | 62 |
Provider is an excellent package for state management in your Flutter apps. It can sometimes be a bit confusing for beginners, but don't worry! In this article, I will guide you through the process of understanding and using Provider in your projects. Let's dive in!
Note: You can view the whole source code used in this article here.
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
void tick() { | |
final newState = | |
pendulum.calculateNextStateOfPendulum(pendulum.previousStates.last); | |
List<StateOfPendulum> newStates = pendulum.previousStates.toList(); | |
newStates.add(newState); | |
// to prevent calling setState when the widget is not in the widget tree | |
if (mounted) { | |
setState(() { | |
pendulum = pendulum.copyWith(previousStates: newStates); |