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
2021-03-04 09:35:37 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0f0d3d1f9657953c03e4054276ae6e0325511cbd
0f0d3d1f
1 parent
abae8916
solving dart migrate errors pt 3
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
203 additions
and
227 deletions
lib/get_rx/src/rx_types/rx_core/rx_impl.dart
lib/get_rx/src/rx_types/rx_core/rx_interface.dart
lib/get_rx/src/rx_types/rx_core/rx_num.dart
lib/get_rx/src/rx_types/rx_iterables/rx_list.dart
lib/get_rx/src/rx_types/rx_iterables/rx_map.dart
lib/get_rx/src/rx_types/rx_iterables/rx_set.dart
lib/get_state_manager/src/rx_flutter/rx_getx_widget.dart
lib/get_utils/src/get_utils/get_utils.dart
test/instance/util/matcher.dart
test/navigation/bottomsheet_test.dart
test/navigation/root_widget_test.dart
test/navigation/routes_test.dart
test/state_manager/get_mixin_state_test.dart
test/utils/extensions/string_extensions_test.dart
lib/get_rx/src/rx_types/rx_core/rx_impl.dart
View file @
0f0d3d1
...
...
@@ -4,8 +4,8 @@ part of rx_types;
/// reactivity
/// of those `Widgets` and Rx values.
mixin
RxObjectMixin
<
T
>
on
NotifyManager
<
T
?>
{
T
?
_value
;
mixin
RxObjectMixin
<
T
>
on
NotifyManager
<
T
>
{
late
T
_value
;
/// Makes a direct update of [value] adding it to the Stream
/// useful when you make use of Rx for custom Types to referesh your UI.
...
...
@@ -39,9 +39,9 @@ mixin RxObjectMixin<T> on NotifyManager<T?> {
/// final inputError = ''.obs..nil();
/// print('${inputError.runtimeType}: $inputError'); // outputs > RxString: null
/// ```
void
nil
()
{
subject
.
add
(
_value
=
null
);
}
// void nil() {
// subject.add(_value = null);
// }
/// Makes this Rx looks like a function so you can update a new
/// value using [rx(someOtherValue)]. Practical to assign the Rx directly
...
...
@@ -59,7 +59,7 @@ mixin RxObjectMixin<T> on NotifyManager<T?> {
/// onChanged: myText,
/// ),
///```
T
?
call
([
T
?
v
])
{
T
call
([
T
?
v
])
{
if
(
v
!=
null
)
{
value
=
v
;
}
...
...
@@ -94,7 +94,7 @@ 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
)
{
set
value
(
T
val
)
{
if
(
_value
==
val
&&
!
firstRebuild
)
return
;
firstRebuild
=
false
;
_value
=
val
;
...
...
@@ -102,7 +102,7 @@ mixin RxObjectMixin<T> on NotifyManager<T?> {
}
/// Returns the current [value]
T
?
get
value
{
T
get
value
{
if
(
RxInterface
.
proxy
!=
null
)
{
RxInterface
.
proxy
!.
addListener
(
subject
);
}
...
...
@@ -145,7 +145,7 @@ mixin NotifyManager<T> {
void
Function
(
T
)
onData
,
{
Function
?
onError
,
void
Function
()?
onDone
,
bool
cancelOnError
=
false
,
bool
?
cancelOnError
,
})
=>
subject
.
listen
(
onData
,
onError:
onError
,
onDone:
onDone
,
cancelOnError:
cancelOnError
);
...
...
@@ -154,7 +154,7 @@ mixin NotifyManager<T> {
void
close
()
{
_subscriptions
.
forEach
((
getStream
,
_subscriptions
)
{
for
(
final
subscription
in
_subscriptions
)
{
subscription
?
.
cancel
();
subscription
.
cancel
();
}
});
...
...
@@ -164,7 +164,7 @@ mixin NotifyManager<T> {
}
/// Base Rx class that manages all the stream logic for any Type.
abstract
class
_RxImpl
<
T
>
extends
RxNotifier
<
T
?
>
with
RxObjectMixin
<
T
>
{
abstract
class
_RxImpl
<
T
>
extends
RxNotifier
<
T
>
with
RxObjectMixin
<
T
>
{
_RxImpl
(
T
initial
)
{
_value
=
initial
;
}
...
...
lib/get_rx/src/rx_types/rx_core/rx_interface.dart
View file @
0f0d3d1
...
...
@@ -5,8 +5,6 @@ part of rx_types;
/// This interface is the contract that [_RxImpl]<[T]> uses in all it's
/// subclass.
abstract
class
RxInterface
<
T
>
{
RxInterface
([
T
?
initial
]);
bool
get
canUpdate
;
/// Adds a listener to stream
...
...
lib/get_rx/src/rx_types/rx_core/rx_num.dart
View file @
0f0d3d1
...
...
@@ -288,13 +288,13 @@ class RxDouble extends _BaseRxNum<double?> {
/// Addition operator.
RxDouble
operator
+(
num
other
)
{
value
+=
other
;
value
=
value
!
+
other
;
return
this
;
}
/// Subtraction operator.
RxDouble
operator
-(
num
other
)
{
value
-=
other
;
value
=
value
!
-
other
;
return
this
;
}
...
...
@@ -413,13 +413,13 @@ class RxInt extends _BaseRxNum<int?> {
/// Addition operator.
RxInt
operator
+(
int
other
)
{
value
+=
other
;
value
=
value
!
+
other
;
return
this
;
}
/// Subtraction operator.
RxInt
operator
-(
int
other
)
{
value
-=
other
;
value
=
value
!
-
other
;
return
this
;
}
...
...
lib/get_rx/src/rx_types/rx_iterables/rx_list.dart
View file @
0f0d3d1
...
...
@@ -75,11 +75,11 @@ class RxList<E> extends ListMixin<E>
}
@override
int
get
length
=>
value
!
.
length
;
int
get
length
=>
value
.
length
;
@override
@protected
List
<
E
>
?
get
value
{
List
<
E
>
get
value
{
if
(
RxInterface
.
proxy
!=
null
)
{
RxInterface
.
proxy
!.
addListener
(
subject
);
}
...
...
@@ -87,28 +87,19 @@ class RxList<E> extends ListMixin<E>
}
@override
@protected
@Deprecated
(
'List.value is deprecated. use [yourList.assignAll(newList)]'
)
set
value
(
List
<
E
>?
val
)
{
if
(
_value
==
val
)
return
;
_value
=
val
;
refresh
();
}
@override
set
length
(
int
newLength
)
{
_value
!
.
length
=
newLength
;
_value
.
length
=
newLength
;
refresh
();
}
@override
void
insertAll
(
int
index
,
Iterable
<
E
>
iterable
)
{
_value
!
.
insertAll
(
index
,
iterable
);
_value
.
insertAll
(
index
,
iterable
);
refresh
();
}
@override
Iterable
<
E
>
get
reversed
=>
value
!
.
reversed
;
Iterable
<
E
>
get
reversed
=>
value
.
reversed
;
@override
Iterable
<
E
>
where
(
bool
Function
(
E
)
test
)
{
...
...
lib/get_rx/src/rx_types/rx_iterables/rx_map.dart
View file @
0f0d3d1
...
...
@@ -57,21 +57,12 @@ class RxMap<K, V> extends MapMixin<K, V>
@override
@protected
Map
<
K
,
V
>
?
get
value
{
Map
<
K
,
V
>
get
value
{
if
(
RxInterface
.
proxy
!=
null
)
{
RxInterface
.
proxy
!.
addListener
(
subject
);
}
return
_value
;
}
@override
@protected
@Deprecated
(
'Map.value is deprecated. use [yourMap.assignAll(newMap)]'
)
set
value
(
Map
<
K
,
V
>?
val
)
{
if
(
_value
==
val
)
return
;
_value
=
val
;
refresh
();
}
}
extension
MapExtension
<
K
,
V
>
on
Map
<
K
,
V
>
{
...
...
lib/get_rx/src/rx_types/rx_iterables/rx_set.dart
View file @
0f0d3d1
...
...
@@ -24,7 +24,7 @@ class RxSet<E> extends SetMixin<E>
@override
@protected
Set
<
E
>
?
get
value
{
Set
<
E
>
get
value
{
if
(
RxInterface
.
proxy
!=
null
)
{
RxInterface
.
proxy
!.
addListener
(
subject
);
}
...
...
@@ -33,7 +33,7 @@ class RxSet<E> extends SetMixin<E>
@override
@protected
set
value
(
Set
<
E
>
?
val
)
{
set
value
(
Set
<
E
>
val
)
{
if
(
_value
==
val
)
return
;
_value
=
val
;
refresh
();
...
...
@@ -109,22 +109,18 @@ class RxSet<E> extends SetMixin<E>
extension
SetExtension
<
E
>
on
Set
<
E
>
{
RxSet
<
E
>
get
obs
{
if
(
this
!=
null
)
{
return
RxSet
<
E
>(<
E
>{})..
addAllNonNull
(
this
);
}
else
{
return
RxSet
<
E
>(
null
);
}
return
RxSet
<
E
>(<
E
>{})..
addAll
(
this
);
}
/// Add [item] to [List<E>] only if [item] is not null.
void
addNonNull
(
E
item
)
{
if
(
item
!=
null
)
add
(
item
);
}
// /// Add [item] to [List<E>] only if [item] is not null.
// void addNonNull(E item) {
// if (item != null) add(item);
// }
/// Add [Iterable<E>] to [List<E>] only if [Iterable<E>] is not null.
void
addAllNonNull
(
Iterable
<
E
>
item
)
{
if
(
item
!=
null
)
addAll
(
item
);
}
// /// Add [Iterable<E>] to [List<E>] only if [Iterable<E>] is not null.
// void addAllNonNull(Iterable<E> item) {
// if (item != null) addAll(item);
// }
/// Add [item] to [List<E>] only if [condition] is true.
void
addIf
(
dynamic
condition
,
E
item
)
{
...
...
lib/get_state_manager/src/rx_flutter/rx_getx_widget.dart
View file @
0f0d3d1
...
...
@@ -10,8 +10,8 @@ import '../../get_state_manager.dart';
typedef
GetXControllerBuilder
<
T
extends
DisposableInterface
>
=
Widget
Function
(
T
controller
);
class
GetX
<
T
extends
DisposableInterface
?>
extends
StatefulWidget
{
final
GetXControllerBuilder
<
T
>?
builder
;
class
GetX
<
T
extends
DisposableInterface
>
extends
StatefulWidget
{
final
GetXControllerBuilder
<
T
>
builder
;
final
bool
global
;
// final Stream Function(T) stream;
...
...
@@ -25,7 +25,7 @@ class GetX<T extends DisposableInterface?> extends StatefulWidget {
const
GetX
({
this
.
tag
,
this
.
builder
,
required
this
.
builder
,
this
.
global
=
true
,
this
.
autoRemove
=
true
,
this
.
initState
,
...
...
@@ -42,7 +42,7 @@ class GetX<T extends DisposableInterface?> extends StatefulWidget {
GetXState
<
T
>
createState
()
=>
GetXState
<
T
>();
}
class
GetXState
<
T
extends
DisposableInterface
?>
extends
State
<
GetX
<
T
?
>>
{
class
GetXState
<
T
extends
DisposableInterface
>
extends
State
<
GetX
<
T
>>
{
GetXState
()
{
_observer
=
RxNotifier
();
}
...
...
@@ -92,8 +92,8 @@ class GetXState<T extends DisposableInterface?> extends State<GetX<T?>> {
@override
void
didUpdateWidget
(
GetX
oldWidget
)
{
super
.
didUpdateWidget
(
oldWidget
as
GetX
<
T
?>);
if
(
widget
.
didUpdateWidget
!=
null
)
widget
.
didUpdateWidget
!(
oldWidget
,
this
);
super
.
didUpdateWidget
(
oldWidget
as
GetX
<
T
>);
widget
.
didUpdateWidget
?.
call
(
oldWidget
,
this
);
}
@override
...
...
@@ -114,7 +114,7 @@ class GetXState<T extends DisposableInterface?> extends State<GetX<T?>> {
Widget
get
notifyChildren
{
final
observer
=
RxInterface
.
proxy
;
RxInterface
.
proxy
=
_observer
;
final
result
=
widget
.
builder
!(
controller
);
final
result
=
widget
.
builder
(
controller
!
);
if
(!
_observer
!.
canUpdate
)
{
throw
"""
[Get] the improper use of a GetX has been detected.
...
...
lib/get_utils/src/get_utils/get_utils.dart
View file @
0f0d3d1
...
...
@@ -534,7 +534,7 @@ class GetUtils {
/// Remove all whitespace inside string
/// Example: your name => yourname
static
String
removeAllWhitespace
(
String
value
)
{
return
value
?
.
replaceAll
(
' '
,
''
);
return
value
.
replaceAll
(
' '
,
''
);
}
/// Camelcase string
...
...
test/instance/util/matcher.dart
View file @
0f0d3d1
...
...
@@ -28,13 +28,13 @@
import
'package:flutter_test/flutter_test.dart'
;
class
_FunctionMatcher
<
T
>
extends
CustomMatcher
{
final
dynamic
Function
(
T
?
value
)
_feature
;
final
Object
Function
(
T
value
)
_feature
;
_FunctionMatcher
(
String
name
,
this
.
_feature
,
matcher
)
:
super
(
'`
$name
`:'
,
'`
$name
`'
,
matcher
);
@override
Object
featureValueOf
(
covariant
T
?
actual
)
=>
_feature
(
actual
);
Object
featureValueOf
(
covariant
T
actual
)
=>
_feature
(
actual
);
}
class
HavingMatcher
<
T
>
implements
TypeMatcher
<
T
>
{
...
...
test/navigation/bottomsheet_test.dart
View file @
0f0d3d1
...
...
@@ -48,27 +48,27 @@ void main() {
Get
.
back
();
expect
(
Get
.
isBottomSheetOpen
,
false
);
expect
(()
=>
Get
.
bottomSheet
(
Container
(),
isScrollControlled:
null
),
throwsAssertionError
);
// expect(() => Get.bottomSheet(Container(), isScrollControlled: null),
// throwsAssertionError);
expect
(()
=>
Get
.
bottomSheet
(
Container
(),
isDismissible:
null
),
throwsAssertionError
);
// expect(() => Get.bottomSheet(Container(), isDismissible: null),
// throwsAssertionError);
expect
(()
=>
Get
.
bottomSheet
(
Container
(),
enableDrag:
null
),
throwsAssertionError
);
// expect(() => Get.bottomSheet(Container(), enableDrag: null),
// throwsAssertionError);
await
tester
.
pumpAndSettle
();
});
testWidgets
(
"GetMaterialApp with debugShowMaterialGrid null"
,
(
tester
)
async
{
expect
(
()
=>
GetMaterialApp
(
debugShowMaterialGrid:
null
,
),
throwsAssertionError
,
);
},
);
// testWidgets(
// "GetMaterialApp with debugShowMaterialGrid null",
// (tester) async {
// expect(
// () => GetMaterialApp(
// debugShowMaterialGrid: null,
// ),
// throwsAssertionError,
// );
// },
// );
}
...
...
test/navigation/root_widget_test.dart
View file @
0f0d3d1
...
...
@@ -2,101 +2,101 @@ import 'package:flutter_test/flutter_test.dart';
import
'package:get/get.dart'
;
void
main
(
)
{
testWidgets
(
"GetMaterialApp with routes null"
,
(
tester
)
async
{
expect
(
()
=>
GetMaterialApp
(
routes:
null
,
),
throwsAssertionError
);
},
);
// testWidgets(
// "GetMaterialApp with routes null",
// (tester) async {
// expect(
// () => GetMaterialApp(
// routes: null,
// ),
// throwsAssertionError);
// },
// );
testWidgets
(
"GetMaterialApp with navigatorObservers null"
,
(
tester
)
async
{
expect
(
()
=>
GetMaterialApp
(
navigatorObservers:
null
,
),
throwsAssertionError
);
},
);
testWidgets
(
"GetMaterialApp with title null"
,
(
tester
)
async
{
expect
(
()
=>
GetMaterialApp
(
title:
null
,
),
throwsAssertionError
);
},
);
testWidgets
(
"GetMaterialApp with debugShowMaterialGrid null"
,
(
test
)
async
{
expect
(
()
=>
GetMaterialApp
(
debugShowMaterialGrid:
null
,
),
throwsAssertionError
,
);
},
);
testWidgets
(
"GetMaterialApp with showPerformanceOverlay null"
,
(
test
)
async
{
expect
(
()
=>
GetMaterialApp
(
showPerformanceOverlay:
null
,
),
throwsAssertionError
,
);
},
);
testWidgets
(
"GetMaterialApp with showSemanticsDebugger null"
,
(
test
)
async
{
expect
(
()
=>
GetMaterialApp
(
showSemanticsDebugger:
null
,
),
throwsAssertionError
,
);
},
);
testWidgets
(
"GetMaterialApp with debugShowCheckedModeBanner null"
,
(
tester
)
async
{
expect
(
()
=>
GetMaterialApp
(
debugShowCheckedModeBanner:
null
,
),
throwsAssertionError
);
},
);
// testWidgets(
// "GetMaterialApp with navigatorObservers null",
// (tester) async {
// expect(
// () => GetMaterialApp(
// navigatorObservers: null,
// ),
// throwsAssertionError);
// },
// );
// testWidgets(
// "GetMaterialApp with title null",
// (tester) async {
// expect(
// () => GetMaterialApp(
// title: null,
// ),
// throwsAssertionError);
// },
// );
// testWidgets(
// "GetMaterialApp with debugShowMaterialGrid null",
// (test) async {
// expect(
// () => GetMaterialApp(
// debugShowMaterialGrid: null,
// ),
// throwsAssertionError,
// );
// },
// );
// testWidgets(
// "GetMaterialApp with showPerformanceOverlay null",
// (test) async {
// expect(
// () => GetMaterialApp(
// showPerformanceOverlay: null,
// ),
// throwsAssertionError,
// );
// },
// );
// testWidgets(
// "GetMaterialApp with showSemanticsDebugger null",
// (test) async {
// expect(
// () => GetMaterialApp(
// showSemanticsDebugger: null,
// ),
// throwsAssertionError,
// );
// },
// );
// testWidgets(
// "GetMaterialApp with debugShowCheckedModeBanner null",
// (tester) async {
// expect(
// () => GetMaterialApp(
// debugShowCheckedModeBanner: null,
// ),
// throwsAssertionError);
// },
// );
testWidgets
(
"GetMaterialApp with checkerboardRasterCacheImages null"
,
(
tester
)
async
{
expect
(
()
=>
GetMaterialApp
(
checkerboardRasterCacheImages:
null
,
),
throwsAssertionError
);
},
);
// testWidgets(
// "GetMaterialApp with checkerboardRasterCacheImages null",
// (tester) async {
// expect(
// () => GetMaterialApp(
// checkerboardRasterCacheImages: null,
// ),
// throwsAssertionError);
// },
// );
testWidgets
(
"GetMaterialApp with checkerboardOffscreenLayers null"
,
(
tester
)
async
{
expect
(
()
=>
GetMaterialApp
(
checkerboardOffscreenLayers:
null
,
),
throwsAssertionError
,
);
},
);
// testWidgets(
// "GetMaterialApp with checkerboardOffscreenLayers null",
// (tester) async {
// expect(
// () => GetMaterialApp(
// checkerboardOffscreenLayers: null,
// ),
// throwsAssertionError,
// );
// },
// );
}
...
...
test/navigation/routes_test.dart
View file @
0f0d3d1
...
...
@@ -3,41 +3,41 @@ import 'package:flutter_test/flutter_test.dart';
import
'package:get/get.dart'
;
void
main
(
)
{
testWidgets
(
'GetPage page null'
,
(
tester
)
async
{
expect
(()
=>
GetPage
(
page:
null
,
name:
null
),
throwsAssertionError
);
},
);
// testWidgets(
// 'GetPage page null',
// (tester) async {
// expect(() => GetPage(page: null, name: null), throwsAssertionError);
// },
// );
testWidgets
(
"GetPage maintainState null"
,
(
tester
)
async
{
expect
(
()
=>
GetPage
(
page:
()
=>
Scaffold
(),
maintainState:
null
,
name:
'/'
),
throwsAssertionError
,
);
},
);
// testWidgets(
// "GetPage maintainState null",
// (tester) async {
// expect(
// () => GetPage(page: () => Scaffold(), maintainState: null, name: '/'),
// throwsAssertionError,
// );
// },
// );
testWidgets
(
"GetPage name null"
,
(
tester
)
async
{
expect
(
()
=>
GetPage
(
page:
()
=>
Scaffold
(),
maintainState:
null
,
name:
null
),
throwsAssertionError
,
);
},
);
// testWidgets(
// "GetPage name null",
// (tester) async {
// expect(
// () => GetPage(page: () => Scaffold(), maintainState: null, name: null),
// throwsAssertionError,
// );
// },
// );
testWidgets
(
"GetPage fullscreenDialog null"
,
(
tester
)
async
{
expect
(
()
=>
GetPage
(
page:
()
=>
Scaffold
(),
fullscreenDialog:
null
,
name:
'/'
),
throwsAssertionError
,
);
},
);
// testWidgets(
// "GetPage fullscreenDialog null",
// (tester) async {
// expect(
// () =>
// GetPage(page: () => Scaffold(), fullscreenDialog: null, name: '/'),
// throwsAssertionError,
// );
// },
// );
}
...
...
test/state_manager/get_mixin_state_test.dart
View file @
0f0d3d1
...
...
@@ -64,18 +64,18 @@ void main() {
expect
(
find
.
text
(
"Count: 2"
),
findsOneWidget
);
});
testWidgets
(
"MixinBuilder with build null"
,
(
tester
)
async
{
expect
(
()
=>
MixinBuilder
<
Controller
>(
init:
Controller
(),
builder:
null
,
),
throwsAssertionError
,
);
},
);
// testWidgets(
// "MixinBuilder with build null",
// (tester) async {
// expect(
// () => MixinBuilder<Controller>(
// init: Controller(),
// builder: null,
// ),
// throwsAssertionError,
// );
// },
// );
}
class
Controller
extends
GetxController
{
...
...
test/utils/extensions/string_extensions_test.dart
View file @
0f0d3d1
...
...
@@ -679,7 +679,7 @@ void main() {
expect
(
'foo bar'
.
capitalize
,
'Foo Bar'
);
expect
(
'FoO bAr'
.
capitalize
,
'Foo Bar'
);
expect
(
'FOO BAR'
.
capitalize
,
'Foo Bar'
);
expect
(
null
.
capitalize
,
null
);
//
expect(null.capitalize, null);
expect
(
''
.
capitalize
,
''
);
expect
(
'foo bar '
.
capitalize
,
'Foo Bar '
);
});
...
...
@@ -688,16 +688,16 @@ void main() {
expect
(
'foo bar'
.
capitalizeFirst
,
'Foo bar'
);
expect
(
'FoO bAr'
.
capitalizeFirst
,
'Foo bar'
);
expect
(
'FOO BAR'
.
capitalizeFirst
,
'Foo bar'
);
expect
(
null
.
capitalizeFirst
,
null
);
//
expect(null.capitalizeFirst, null);
expect
(
''
.
capitalizeFirst
,
''
);
});
test
(
'var.removeAllWhitespace'
,
()
{
late
String
nullString
;
//
late String nullString;
expect
(
'foo bar'
.
removeAllWhitespace
,
'foobar'
);
expect
(
'foo'
.
removeAllWhitespace
,
'foo'
);
expect
(
''
.
removeAllWhitespace
,
''
);
expect
(
nullString
.
removeAllWhitespace
,
null
);
//
expect(nullString.removeAllWhitespace, null);
});
test
(
'var.camelCase'
,
()
{
...
...
Please
register
or
login
to post a comment