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
Authored by
Jonny Borges
2020-09-04 13:50:32 -0300
Browse Files
Options
Browse Files
Download
Plain Diff
Committed by
GitHub
2020-09-04 13:50:32 -0300
Commit
61b4dabb7c58e9bd78f46c989ca3718e7fb0d75f
61b4dabb
2 parents
f8606c6c
c7a4c31c
Merge pull request #560 from roipeker/master
added json support to Rx
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
lib/src/state_manager/rx/rx_core/rx_impl.dart
lib/src/state_manager/rx/rx_core/rx_impl.dart
View file @
61b4dab
import
'dart:async'
;
import
'dart:collection'
;
import
'../rx_core/rx_interface.dart'
;
RxInterface
getObs
;
...
...
@@ -22,7 +23,7 @@ class _RxImpl<T> implements RxInterface<T> {
/// ```
///
/// WARNING: still WIP, needs testing!
_RxImpl
<
T
>
operator
>>
(
T
val
)
{
_RxImpl
<
T
>
operator
<<
(
T
val
)
{
subject
.
add
(
value
=
val
);
return
this
;
}
...
...
@@ -102,6 +103,8 @@ class _RxImpl<T> implements RxInterface<T> {
@override
String
toString
()
=>
value
.
toString
();
dynamic
toJson
()
=>
value
;
/// This equality override works for _RxImpl instances and the internal values.
@override
bool
operator
==(
dynamic
o
)
{
...
...
@@ -285,6 +288,11 @@ class Rx<T> extends _RxImpl<T> {
Rx
([
T
initial
])
{
_value
=
initial
;
}
// TODO: Look for a way to throw the Exception with proper details when the
// value [T] doesn't implement toJson().
@override
dynamic
toJson
()
=>
(
value
as
dynamic
)?.
toJson
();
}
extension
StringExtension
on
String
{
...
...
Please
register
or
login
to post a comment