Jonatas Borges

update to 4.0.1

## [4.0.1]
- Fix changelog
## [4.0.0]
- Added append function to StateMixin. Now is possible track loading, success and error handle of your application with ONE LINE OF CODE. Ex: append(()=> api.getUser);
- Migrate to null-safety
- Added ScrollMixin to controllers
- Added loadingMore status to RxStatus
- Breaking: It is not possible to initialize Rx with null values.
- Fix content-type qual null (@katekko)
- Made GetInstance non nullable (@eduardoflorence)
- Fix multi-parameters url (@iMrLopez)
- Fix Expected value of SkDeletable error (@obadajasm)
- Added triggers, an Rx method that triggers events, even if they are the same as the previous event (@RafaRuiz)
- Improve docs: (@CNAD666), (@dhhAndroid), (@Jackylee1992),
Switching to null-safety:
You can continue using GetX as normal, with as little breaking changes as possible.
It is still possible to declare the var.obs variable, and this remains the preferred way, forcing null-safety and giving you all the security that sound null-safety delivers to your app. However, if you need to use null, we also provide a solution for you.
Declare the variables with `?` Ex: `final Rx<int?> count = 0.obs`.
You can also use custom Rxn types with null-safety:
`RxInt` == not nullable
`RxnInt` == nullable.
## [3.25.6]
- Added documentation in French (@kamazoun)
... ...
... ... @@ -20,6 +20,7 @@ linter:
# INCLUDE_FIX (copy of effective dart 1.2.0)
# STYLE
camel_case_types: true
close_sinks: true
camel_case_extensions: true
library_names: true
file_names: true
... ...
... ... @@ -90,7 +90,7 @@ class BaseWebSocket {
}
void close([int? status, String? reason]) {
if (socket != null) socket!.close(status, reason);
socket?.close(status, reason);
}
void send(dynamic data) {
... ...
... ... @@ -82,9 +82,7 @@ class BaseWebSocket {
}
void close([int? status, String? reason]) {
if (socket != null) {
socket!.close(status, reason);
}
socket?.close(status, reason);
}
void send(dynamic data) async {
... ...
... ... @@ -95,9 +95,11 @@ mixin RxObjectMixin<T> on NotifyManager<T> {
/// Updates the [value] and adds it to the stream, updating the observer
/// Widget, only if it's different from the previous value.
set value(T val) {
if (subject.isClosed) return;
if (_value == val && !firstRebuild) return;
firstRebuild = false;
_value = val;
subject.add(_value);
}
... ... @@ -236,15 +238,32 @@ abstract class _RxImpl<T> extends RxNotifier<T> with RxObjectMixin<T> {
}
}
extension RxBoolExt on Rx<bool> {}
/// Rx class for `bool` Type.
class RxBool extends _RxImpl<bool> {
class RxBool extends Rx<bool> {
RxBool(bool initial) : super(initial);
@override
String toString() {
return value ? "true" : "false";
}
}
bool? get isTrue => value;
class RxnBool extends Rx<bool?> {
RxnBool(bool initial) : super(initial);
@override
String toString() {
if (value == null) {
return "null";
} else if (value) {
return "true";
} else {
return "false";
}
}
}
extension RxBoolExt on Rx<bool> {
bool get isTrue => value;
bool get isFalse => !isTrue!;
bool get isFalse => !isTrue;
bool operator &(bool other) => other && value;
... ... @@ -257,14 +276,43 @@ class RxBool extends _RxImpl<bool> {
/// FIXME: why return this? fluent interface is not
/// not really a dart thing since we have '..' operator
// ignore: avoid_returning_this
RxBool toggle() {
Rx<bool> toggle() {
subject.add(_value = !_value);
return this;
}
}
@override
String toString() {
return value ? "true" : "false";
extension RxnBoolExt on Rx<bool?> {
bool? get isTrue => value;
bool? get isFalse {
if (value != null) return !isTrue!;
}
bool? operator &(bool other) {
if (value != null) {
return other && value!;
}
}
bool? operator |(bool other) {
if (value != null) {
return other || value!;
}
}
bool? operator ^(bool other) => !other == value;
/// Toggles the bool [value] between false and true.
/// A shortcut for `flag.value = !flag.value;`
/// FIXME: why return this? fluent interface is not
/// not really a dart thing since we have '..' operator
// ignore: avoid_returning_this
Rx<bool?>? toggle() {
if (_value != null) {
subject.add(_value = !_value!);
return this;
}
}
}
... ...
name: get
description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX.
version: 4.0.0
version: 4.0.1
homepage: https://github.com/jonataslaw/getx
environment:
... ...
... ... @@ -94,6 +94,7 @@ void main() {
await Future.delayed(Duration.zero);
expect(count, 555);
controller.close();
});
test('Rx same value will not call the same listener when `call`', () async {
... ...