diff --git a/lib/model/delayed_function_caller.dart b/lib/model/delayed_function_caller.dart index d439537..46efcba 100644 --- a/lib/model/delayed_function_caller.dart +++ b/lib/model/delayed_function_caller.dart @@ -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); } } diff --git a/lib/model/movie_manager.dart b/lib/model/movie_manager.dart index 07300ea..874ff10 100644 --- a/lib/model/movie_manager.dart +++ b/lib/model/movie_manager.dart @@ -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) {