Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
fluttertpc_get
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
You need to sign in or sign up before continuing.
Authored by
Jonny Borges
2020-05-26 20:46:25 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2020-05-26 20:46:25 -0300
Commit
0c95723e27ab1690c2c3914d42a5b723bea6c5be
0c95723e
1 parent
abb56fd4
bump to 2.7.1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
24 deletions
CHANGELOG.md
get.png
lib/src/rx/rx_impl.dart
lib/src/rx/rx_interface.dart
pubspec.yaml
CHANGELOG.md
View file @
0c95723
## [2.7.1]
-
Improve list to set and get methods
## [2.7.0]
-
Added obx, a simple state interceptor.
-
Improve Bindings, ListX, and fix docs typos
...
...
get.png
View file @
0c95723
40.4 KB
|
W:
|
H:
23.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
lib/src/rx/rx_impl.dart
View file @
0c95723
...
...
@@ -11,14 +11,17 @@ class _StoredValue<T> implements RxInterface<T> {
Map
<
Stream
<
Change
<
T
>>,
StreamSubscription
>
_subscriptions
=
Map
();
T
_value
;
T
get
v
alue
{
T
get
v
{
if
(
Get
.
obs
!=
null
)
{
Get
.
obs
.
addListener
(
subject
.
stream
);
}
return
_value
;
}
String
get
string
=>
value
.
toString
();
T
get
value
=>
v
;
set
value
(
T
va
)
=>
v
=
va
;
String
get
string
=>
v
.
toString
();
close
()
{
_subscriptions
.
forEach
((
observable
,
subscription
)
{
...
...
@@ -38,7 +41,7 @@ class _StoredValue<T> implements RxInterface<T> {
});
}
set
v
alue
(
T
val
)
{
set
v
(
T
val
)
{
if
(
_value
==
val
)
return
;
T
old
=
_value
;
_value
=
val
;
...
...
@@ -51,14 +54,14 @@ class _StoredValue<T> implements RxInterface<T> {
_onChange
=
subject
.
stream
.
asBroadcastStream
();
}
void
setCast
(
dynamic
/* T */
val
)
=>
v
alue
=
val
;
void
setCast
(
dynamic
/* T */
val
)
=>
v
=
val
;
Stream
<
Change
<
T
>>
_onChange
;
Stream
<
Change
<
T
>>
get
onChange
{
_cb
++;
_changeCtl
.
add
(
Change
<
T
>(
$new
:
v
alue
,
$old
:
null
,
batch:
_cb
));
_changeCtl
.
add
(
Change
<
T
>(
$new
:
v
,
$old
:
null
,
batch:
_cb
));
_changeCtl
.
addStream
(
_onChange
.
skipWhile
((
v
)
=>
v
.
batch
<
_cb
));
return
_changeCtl
.
stream
.
asBroadcastStream
();
}
...
...
@@ -66,11 +69,11 @@ class _StoredValue<T> implements RxInterface<T> {
Stream
<
T
>
get
stream
=>
onChange
.
map
((
c
)
=>
c
.
$new
);
void
bind
(
RxInterface
<
T
>
reactive
)
{
value
=
reactive
.
value
;
reactive
.
stream
.
listen
((
v
)
=>
value
=
v
);
v
=
reactive
.
v
;
reactive
.
stream
.
listen
((
va
)
=>
v
=
va
);
}
void
bindStream
(
Stream
<
T
>
stream
)
=>
stream
.
listen
((
v
)
=>
value
=
v
);
void
bindStream
(
Stream
<
T
>
stream
)
=>
stream
.
listen
((
v
a
)
=>
v
=
va
);
void
bindOrSet
(
/* T | Stream<T> | Reactive<T> */
other
)
{
if
(
other
is
RxInterface
<
T
>)
{
...
...
@@ -78,7 +81,7 @@ class _StoredValue<T> implements RxInterface<T> {
}
else
if
(
other
is
Stream
<
T
>)
{
bindStream
(
other
.
cast
<
T
>());
}
else
{
v
alue
=
other
;
v
=
other
;
}
}
...
...
@@ -245,22 +248,19 @@ class ListX<E> extends DelegatingList<E> implements List<E>, RxInterface<E> {
});
}
// @override
// int get length => list.length;
// List<E> get list => value as List<E>;
List
<
E
>
get
value
=>
v
as
List
<
E
>;
// set list(List<E> v) => assignAll(v
);
set
value
(
List
<
E
>
va
)
=>
assignAll
(
va
);
@override
get
v
alue
{
get
v
{
if
(
Get
.
obs
!=
null
)
{
Get
.
obs
.
addListener
(
subject
.
stream
);
}
return
this
;
}
set
v
alue
(
E
val
)
{
set
v
(
E
val
)
{
assign
(
val
);
}
...
...
@@ -269,11 +269,11 @@ class ListX<E> extends DelegatingList<E> implements List<E>, RxInterface<E> {
@override
void
bind
(
RxInterface
<
E
>
reactive
)
{
value
=
reactive
.
value
;
reactive
.
stream
.
listen
((
v
)
=>
value
=
v
);
v
=
reactive
.
v
;
reactive
.
stream
.
listen
((
va
)
=>
v
=
va
);
}
void
bindStream
(
Stream
<
E
>
stream
)
=>
stream
.
listen
((
v
)
=>
value
=
v
);
void
bindStream
(
Stream
<
E
>
stream
)
=>
stream
.
listen
((
v
a
)
=>
v
=
va
);
@override
void
bindOrSet
(
/* T | Stream<T> or Rx<T> */
other
)
{
...
...
@@ -282,7 +282,7 @@ class ListX<E> extends DelegatingList<E> implements List<E>, RxInterface<E> {
}
else
if
(
other
is
Stream
<
E
>)
{
bindStream
(
other
.
cast
<
E
>());
}
else
{
v
alue
=
other
;
v
=
other
;
}
}
...
...
@@ -291,7 +291,7 @@ class ListX<E> extends DelegatingList<E> implements List<E>, RxInterface<E> {
stream
.
listen
(
callback
);
@override
void
setCast
(
dynamic
val
)
=>
v
alue
=
val
;
void
setCast
(
dynamic
val
)
=>
v
=
val
;
}
typedef
bool
Condition
(
);
...
...
lib/src/rx/rx_interface.dart
View file @
0c95723
...
...
@@ -6,10 +6,10 @@ abstract class RxInterface<T> {
RxInterface
([
T
initial
]);
/// Get current value
get
v
alue
;
get
v
;
/// Set value
set
v
alue
(
T
val
);
set
v
(
T
val
);
/// Cast [val] to [T] before setting
void
setCast
(
dynamic
/* T */
val
);
...
...
pubspec.yaml
View file @
0c95723
name
:
get
description
:
Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
version
:
2.7.
0
version
:
2.7.
1
homepage
:
https://github.com/jonataslaw/get
environment
:
...
...
Please
register
or
login
to post a comment