diff --git a/CHANGELOG.md b/CHANGELOG.md index 63ecd16..220ddaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.4.3 + +- [FIX] Ensure that `FixedSizeList` takes any type of object. + ## 1.4.2 - Added the `isLeapYear` extension to the `DateTime` and `int` objects. diff --git a/lib/src/classes/fixed_size_list.dart b/lib/src/classes/fixed_size_list.dart index b17f546..24083bc 100644 --- a/lib/src/classes/fixed_size_list.dart +++ b/lib/src/classes/fixed_size_list.dart @@ -2,20 +2,20 @@ /// /// When a new element is added and the list reaches its maximum capacity, /// the oldest element in the list is automatically removed to make space. -class FixedSizeList { +class FixedSizeList { final int _capacity; - final List _list; + final List _list; /// Creates a [FixedSizeList] with the specified [capacity]. /// /// The initial list will be empty. - FixedSizeList(this._capacity) : _list = []; + FixedSizeList(this._capacity) : _list = []; /// Adds a new [element] to the list. /// /// If the list is already at its maximum [capacity], the oldest element /// will be removed before the new [element] is added. - void add(String element) { + void add(T? element) { _list.add(element); if (_list.length > _capacity) { _list.removeAt(0); @@ -25,5 +25,5 @@ class FixedSizeList { /// Returns an unmodifiable view of the current items in the list. /// /// This prevents external modification of the internal list. - List get items => List.unmodifiable(_list); + List get items => List.unmodifiable(_list); } diff --git a/pubspec.yaml b/pubspec.yaml index 1bb34c7..c986a83 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: arcane_helper_utils description: Provides a variety of helpful utilities and extensions for Flutter and Dart. -version: 1.4.2 +version: 1.4.3 repository: https://github.com/hanskokx/arcane_helper_utils issue_tracker: https://github.com/hanskokx/arcane_helper_utils/issues