main
daniel-michel 2024-01-08 11:56:35 +01:00
parent f9a0482e3c
commit 688fa63da2
2 changed files with 4 additions and 6 deletions

View File

@ -1,7 +1,7 @@
import 'dart:async';
class DelayedFunctionCaller {
final Function function;
final void Function() function;
final Duration duration;
Timer? _timer;
@ -14,8 +14,6 @@ class DelayedFunctionCaller {
}
// Create a timer that calls the function after the specified duration.
_timer = Timer(duration, () {
function();
});
_timer = Timer(duration, function);
}
}

View File

@ -67,8 +67,8 @@ class MovieManager extends ChangeNotifier {
void _insertMovie(MovieData movie) {
int min = 0;
int max = movies.length - 1;
while (min - 1 < max) {
int center = ((min + max) / 2).floor();
while (min <= max) {
int center = (min + max) ~/ 2;
int diff =
movie.releaseDate.date.compareTo(movies[center].releaseDate.date);
if (diff < 0) {