Skip to content

Instantly share code, notes, and snippets.

View Tomic-Riedel's full-sized avatar

Tomic-Riedel Tomic-Riedel

View GitHub Profile

In diesem Beispiel ist d also der Logarithmus aus 8 zur Basis 2, also d=log_2

@Tomic-Riedel
Tomic-Riedel / merge_sort.dart
Created February 20, 2022 06:11
An implementation of MergeSort in Dart
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;
@Tomic-Riedel
Tomic-Riedel / test-data.csv
Last active April 13, 2023 14:10
Test Data
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

Flutter Provider explained - The complete crash course

Introduction

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.

Why should I learn Provider?

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);