Jonatas

cleaner structure

{
"cSpell.enableFiletypes": [
"markdown"
]
}
\ No newline at end of file
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.40.2"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.2"
version: "2.5.0-nullsafety"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.0-nullsafety.2"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
version: "1.2.0-nullsafety"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.1.0-nullsafety"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.13"
version: "1.15.0-nullsafety.2"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
coverage:
dependency: transitive
description:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
dio:
dependency: "direct main"
description:
... ... @@ -56,7 +105,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.0-nullsafety"
flutter:
dependency: "direct main"
description: flutter
... ... @@ -68,12 +117,40 @@ packages:
source: sdk
version: "0.0.0"
get:
dependency: "direct main"
dependency: transitive
description:
path: ".."
relative: true
source: path
name: get
url: "https://pub.dartlang.org"
source: hosted
version: "3.10.2"
get_test:
dependency: "direct main"
description:
name: get_test
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.3"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.2"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
http_parser:
dependency: transitive
description:
... ... @@ -81,87 +158,270 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
image_test_utils:
dependency: transitive
description:
name: image_test_utils
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
io:
dependency: transitive
description:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.4"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3-nullsafety"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.8"
version: "0.12.10-nullsafety"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
version: "1.3.0-nullsafety.2"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7"
mockito:
dependency: transitive
description:
name: mockito
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
node_interop:
dependency: transitive
description:
name: node_interop
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
node_io:
dependency: transitive
description:
name: node_io
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
node_preamble:
dependency: transitive
description:
name: node_preamble
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.12"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0-nullsafety"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0-nullsafety"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0-nullsafety"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.9"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
shelf_static:
dependency: transitive
description:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.8"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.3"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.1"
source_maps:
dependency: transitive
description:
name: source_maps
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.10-nullsafety"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0-nullsafety"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.5"
version: "1.10.0-nullsafety"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "1.1.0-nullsafety"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0-nullsafety"
test:
dependency: transitive
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.0-nullsafety.4"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.17"
version: "0.2.19-nullsafety"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.12-nullsafety.4"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.0-nullsafety.2"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.1.0-nullsafety.2"
vm_service:
dependency: transitive
description:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0+1"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+15"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
webkit_inspection_protocol:
dependency: transitive
description:
name: webkit_inspection_protocol
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.3"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
sdks:
dart: ">=2.9.0-14.0.dev <3.0.0"
dart: ">=2.10.0-0.0.dev <2.10.0"
flutter: ">=1.17.0 <2.0.0"
... ...
... ... @@ -26,9 +26,10 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
get:
path: ../
# get:
# path: ../
dio: ^3.0.9
get_test:
dev_dependencies:
flutter_test:
... ...
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:get/get.dart';
import 'package:get_demo/pages/home/domain/adapters/repository_adapter.dart';
import 'package:get_demo/pages/home/domain/entity/cases_model.dart';
import 'package:get_demo/pages/home/presentation/controllers/home_controller.dart';
import 'package:matcher/matcher.dart';
import 'package:get_demo/routes/app_pages.dart';
import 'package:get_test/get_test.dart';
import 'package:matcher/matcher.dart' as m;
class MockRepository implements IHomeRepository {
@override
... ... @@ -43,7 +45,7 @@ void main() {
});
test('Test Controller', () async {
/// Controller can't be on memory
expect(() => Get.find<HomeController>(), throwsA(TypeMatcher<String>()));
expect(() => Get.find<HomeController>(), throwsA(m.TypeMatcher<String>()));
/// build Binding
binding.builder();
... ... @@ -69,4 +71,104 @@ void main() {
expect(controller.cases.value.global.totalConfirmed, 200);
}
});
/// Tests with GetTests
getTest(
"test description",
getPages: AppPages.routes,
initialRoute: AppPages.INITIAL,
widgetTest: (tester) async {
expect('/home', Get.currentRoute);
Get.toNamed('/country');
expect('/country', Get.currentRoute);
Get.toNamed('/details');
expect('/details', Get.currentRoute);
Get.back();
expect('/country', Get.currentRoute);
},
);
testGetX(
'GetX test',
widget: GetX<Controller>(
init: Controller(),
builder: (controller) {
return Text("ban:${controller.count}");
},
),
test: (e) {
expect(find.text("ban:0"), findsOneWidget);
expect(e.count.value, 0);
},
);
testGetBuilder(
'GetBuilder test',
widget: GetBuilder<Controller>(
init: Controller(),
builder: (controller) {
return Text("ban:${controller.count}");
},
),
test: (e) {
expect(find.text("ban:0"), findsOneWidget);
expect(e.count.value, 0);
},
);
testObx(
'Obx test',
widget: (controller) => Obx(
() => Text("ban:${controller.count}"),
),
controller: Controller(),
test: (e) {
expect(find.text("ban:0"), findsOneWidget);
expect(e.count.value, 0);
},
);
testController<Controller>(
'Controller test',
(controller) {
print('controllllllll ${controller.count}');
},
controller: Controller(),
onInit: (c) {
c.increment();
print('onInit');
},
onReady: (c) {
print('onReady');
c.increment();
},
onClose: (c) {
print('onClose');
},
);
}
class Controller extends GetxController {
final count = 0.obs;
void increment() => count.value++;
@override
void onInit() {
print('inittt');
super.onInit();
}
@override
void onReady() {
print('onReady');
super.onReady();
}
void onClose() {
print('onClose');
}
}
... ...
import '../navigation/root/smart_management.dart';
import 'log.dart';
/// Use Get.to instead of Navigator.push, Get.off instead
/// of Navigator.pushReplacement,
/// Get.offAll instead of Navigator.pushAndRemoveUntil.
... ... @@ -6,5 +9,10 @@
/// To return to the previous screen, use Get.back().
/// No need to pass any context to Get, just put the name of the route inside
/// the parentheses and the magic will occur.
abstract class GetInterface {
SmartManagement smartManagement = SmartManagement.full;
String reference;
bool isLogEnable = true;
LogWriterCallback log = defaultLogWriterCallback;
}
abstract class GetInterface {}
... ...
import 'dart:developer' as developer;
import '../../instance_manager.dart';
import 'get_main.dart';
typedef LogWriterCallback = void Function(String text, {bool isError});
void defaultLogWriterCallback(String value, {bool isError = false}) {
if (isError || GetConfig.isLogEnable) developer.log(value, name: 'GETX');
if (isError || Get.isLogEnable) developer.log(value, name: 'GETX');
}
... ...
... ... @@ -8,7 +8,7 @@ extension Inst on GetInterface {
/// the Instance and persisted as a Singleton (like you would use
/// [Get.put()]).
///
/// Using [GetConfig.smartManagement] as [SmartManagement.keepFactory] has
/// Using [Get.smartManagement] as [SmartManagement.keepFactory] has
/// the same outcome
/// as using [fenix:true] :
/// The internal register of [builder()] will remain in memory to recreate
... ... @@ -73,7 +73,7 @@ extension Inst on GetInterface {
/// of the same Type<[S]> the [tag] does **not** conflict with the same tags
/// used by other [dependencies] Types.
/// - [permanent] keeps the Instance in memory and persist it,
/// not following [GetConfig.smartManagement]
/// not following [Get.smartManagement]
/// rules. Although, can be removed by [GetInstance.reset()]
/// and [Get.delete()]
/// - [builder] If defined, the [dependency] must be returned from here
... ...
import 'dart:async';
import 'dart:collection';
import '../core/log.dart';
import '../core/get_main.dart';
import '../navigation/root/smart_management.dart';
import '../state_manager/rx/rx_core/rx_interface.dart';
import '../utils/queue/get_queue.dart';
// ignore: avoid_classes_with_only_static_members
class GetConfig {
static SmartManagement smartManagement = SmartManagement.full;
static bool isLogEnable = true;
static LogWriterCallback log = defaultLogWriterCallback;
static String currentRoute;
}
class GetInstance {
factory GetInstance() => _getInstance ??= GetInstance._();
... ... @@ -21,7 +11,7 @@ class GetInstance {
static GetInstance _getInstance;
static final config = GetConfig();
// static final config = Get();
/// Holds references to every registered Instance when using
/// [Get.put()]
... ... @@ -31,25 +21,23 @@ class GetInstance {
/// [Get.lazyPut()]
static final Map<String, _Lazy> _factory = {};
/// Holds a reference to [GetConfig.currentRoute] when the Instance was
/// Holds a reference to [Get.reference] when the Instance was
/// created to manage the memory.
static final Map<String, String> _routesKey = {};
/// Stores the onClose() references of instances created with [Get.create()]
/// using the [GetConfig.currentRoute].
/// using the [Get.reference].
/// Experimental feature to keep the lifecycle and memory management with
/// non-singleton instances.
static final Map<String, HashSet<Function>> _routesByCreate = {};
static final _queue = GetQueue();
/// Creates a new Instance<S> lazily from the [<S>builder()] callback.
///
/// The first time you call [Get.find()], the [builder()] callback will create
/// the Instance and persisted as a Singleton (like you would
/// use [Get.put()]).
///
/// Using [GetConfig.smartManagement] as [SmartManagement.keepFactory] has
/// Using [Get.smartManagement] as [SmartManagement.keepFactory] has
/// the same outcome as using [fenix:true] :
/// The internal register of [builder()] will remain in memory to recreate
/// the Instance if the Instance has been removed with [Get.delete()].
... ... @@ -94,7 +82,7 @@ class GetInstance {
/// - [tag] optionally, use a [tag] as an "id" to create multiple records of
/// the same Type<[S]>
/// - [permanent] keeps the Instance in memory, not following
/// [GetConfig.smartManagement] rules.
/// [Get.smartManagement] rules.
S put<S>(
S dependency, {
String tag,
... ... @@ -113,7 +101,7 @@ class GetInstance {
/// Every time [find]<[S]>() is used, it calls the builder method to generate
/// a new Instance [S].
/// It also registers each [instance.onClose()] with the current
/// Route [GetConfig.currentRoute] to keep the lifecycle active.
/// Route [Get.reference] to keep the lifecycle active.
/// Is important to know that the instances created are only stored per Route.
/// So, if you call `Get.delete<T>()` the "instance factory" used in this
/// method ([Get.create<T>()]) will be removed, but NOT the instances
... ... @@ -150,7 +138,7 @@ class GetInstance {
}
/// Clears from memory registered Instances associated with [routeName] when
/// using [GetConfig.smartManagement] as [SmartManagement.full] or
/// using [Get.smartManagement] as [SmartManagement.full] or
/// [SmartManagement.keepFactory]
/// Meant for internal usage of [GetPageRoute] and [GetDialogRoute]
Future<void> removeDependencyByRoute(String routeName) async {
... ... @@ -187,8 +175,8 @@ class GetInstance {
/// Initializes the dependencies for a Class Instance [S] (or tag),
/// If its a Controller, it starts the lifecycle process.
/// Optionally associating the current Route to the lifetime of the instance,
/// if [GetConfig.smartManagement] is marked as [SmartManagement.full] or
/// [GetConfig.keepFactory]
/// if [Get.smartManagement] is marked as [SmartManagement.full] or
/// [Get.keepFactory]
/// Only flags `isInit` if it's using `Get.create()`
/// (not for Singletons access).
bool _initDependencies<S>({String name}) {
... ... @@ -198,7 +186,7 @@ class GetInstance {
_startController<S>(tag: name);
if (_singl[key].isSingleton) {
_singl[key].isInit = true;
if (GetConfig.smartManagement != SmartManagement.onlyBuilder) {
if (Get.smartManagement != SmartManagement.onlyBuilder) {
_registerRouteInstance<S>(tag: name);
}
}
... ... @@ -209,7 +197,7 @@ class GetInstance {
/// Links a Class instance [S] (or [tag]) to the current route.
/// Requires usage of [GetMaterialApp].
void _registerRouteInstance<S>({String tag}) {
_routesKey.putIfAbsent(_getKey(S, tag), () => GetConfig.currentRoute);
_routesKey.putIfAbsent(_getKey(S, tag), () => Get.reference);
}
/// Finds and returns a Instance<[S]> (or [tag]) without further processing.
... ... @@ -225,11 +213,11 @@ class GetInstance {
if (i is DisposableInterface) {
if (i.onStart != null) {
i.onStart();
GetConfig.log('"$key" has been initialized');
Get.log('"$key" has been initialized');
}
if (!_singl[key].isSingleton && i.onClose != null) {
_routesByCreate[GetConfig.currentRoute] ??= HashSet<Function>();
_routesByCreate[GetConfig.currentRoute].add(i.onClose);
_routesByCreate[Get.reference] ??= HashSet<Function>();
_routesByCreate[Get.reference].add(i.onClose);
}
}
}
... ... @@ -243,7 +231,7 @@ class GetInstance {
// if (_factory.containsKey(key)) {
// S _value = put<S>((_factory[key].builder() as S), tag: tag);
// if (GetConfig.smartManagement != SmartManagement.keepFactory) {
// if (Get.smartManagement != SmartManagement.keepFactory) {
// if (!_factory[key].fenix) {
// _factory.remove(key);
// }
... ... @@ -278,11 +266,11 @@ class GetInstance {
throw '"$S" not found. You need to call "Get.put($S())" or "Get.lazyPut(()=>$S())"';
}
GetConfig.log('Lazy instance "$S" created');
Get.log('Lazy instance "$S" created');
final _value = put<S>(_factory[key].builder() as S, tag: tag);
_initDependencies<S>(name: tag);
if (GetConfig.smartManagement != SmartManagement.keepFactory &&
if (Get.smartManagement != SmartManagement.keepFactory &&
!_factory[key].fenix) {
_factory.remove(key);
}
... ... @@ -339,15 +327,14 @@ class GetInstance {
Future<bool> delete<S>({String tag, String key, bool force = false}) async {
final newKey = key ?? _getKey(S, tag);
return _queue.add<bool>(() async {
if (!_singl.containsKey(newKey)) {
GetConfig.log('Instance "$newKey" already removed.', isError: true);
Get.log('Instance "$newKey" already removed.', isError: true);
return false;
}
final builder = _singl[newKey];
if (builder.permanent && !force) {
GetConfig.log(
Get.log(
// ignore: lines_longer_than_80_chars
'"$newKey" has been marked as permanent, SmartManagement is not authorized to delete it.',
isError: true,
... ... @@ -361,18 +348,17 @@ class GetInstance {
}
if (i is DisposableInterface) {
await i.onClose();
GetConfig.log('"$newKey" onClose() called');
Get.log('"$newKey" onClose() called');
}
_singl.removeWhere((oldKey, value) => (oldKey == newKey));
if (_singl.containsKey(newKey)) {
GetConfig.log('Error removing object "$newKey"', isError: true);
Get.log('Error removing object "$newKey"', isError: true);
} else {
GetConfig.log('"$newKey" deleted from memory');
Get.log('"$newKey" deleted from memory');
}
// _routesKey?.remove(key);
return true;
});
}
/// Check if a Class Instance<[S]> (or [tag]) is registered in memory.
... ... @@ -403,7 +389,7 @@ class _InstanceBuilderFactory<S> {
InstanceBuilderCallback<S> builderFunc;
/// Flag to persist the instance in memory,
/// without considering [GetConfig.smartManagement]
/// without considering [Get.smartManagement]
bool permanent = false;
bool isInit = false;
... ...
... ... @@ -31,7 +31,7 @@ class GetDialogRoute<T> extends PopupRoute<T> {
@override
void dispose() {
if (GetConfig.smartManagement != SmartManagement.onlyBuilder) {
if (Get.smartManagement != SmartManagement.onlyBuilder) {
WidgetsBinding.instance.addPostFrameCallback(
(_) => GetInstance().removeDependencyByRoute(name));
}
... ...
... ... @@ -11,6 +11,8 @@ import 'root/parse_route.dart';
import 'root/root_controller.dart';
import 'routes/bindings_interface.dart';
//TODO: Split this class on "Snackbar" "Dialog" "bottomSheet"
//and "navigation" extensions
extension GetNavigation on GetInterface {
/// **Navigation.push()** shortcut.<br><br>
///
... ... @@ -884,10 +886,10 @@ extension GetNavigation on GetInterface {
bool defaultGlobalState,
Transition defaultTransition}) {
if (enableLog != null) {
GetConfig.isLogEnable = enableLog;
Get.isLogEnable = enableLog;
}
if (logWriterCallback != null) {
GetConfig.log = logWriterCallback;
Get.log = logWriterCallback;
}
if (defaultPopGesture != null) {
getxController.defaultPopGesture = defaultPopGesture;
... ...
... ... @@ -2,7 +2,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import '../../../get.dart';
import '../../core/log.dart';
import '../../instance/get_instance.dart';
import '../extension_navigation.dart';
import '../routes/get_route.dart';
import 'root_controller.dart';
... ... @@ -201,18 +200,17 @@ class GetMaterialApp extends StatelessWidget {
initialBinding?.dependencies();
Get.addPages(getPages);
GetConfig.smartManagement = smartManagement;
Get.smartManagement = smartManagement;
onInit?.call();
Get.config(
enableLog: enableLog ?? GetConfig.isLogEnable,
enableLog: enableLog ?? Get.isLogEnable,
logWriterCallback: logWriterCallback,
defaultTransition: defaultTransition ?? Get.defaultTransition,
defaultOpaqueRoute: opaqueRoute ?? Get.isOpaqueRouteDefault,
defaultPopGesture: popGesture ?? Get.isPopGestureEnable,
defaultDurationTransition:
transitionDuration ?? Get.defaultTransitionDuration,
);
},
builder: (_) {
... ...
... ... @@ -113,7 +113,7 @@ class GetPageRoute<T> extends PageRoute<T> {
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
GetConfig.currentRoute = settings.name ?? routeName;
Get.reference = settings.name ?? routeName;
binding?.dependencies();
if (bindings != null) {
for (final binding in bindings) {
... ... @@ -374,7 +374,7 @@ class GetPageRoute<T> extends PageRoute<T> {
@override
void dispose() {
if (GetConfig.smartManagement != SmartManagement.onlyBuilder) {
if (Get.smartManagement != SmartManagement.onlyBuilder) {
WidgetsBinding.instance.addPostFrameCallback((_) => GetInstance()
.removeDependencyByRoute("${settings?.name ?? routeName}"));
}
... ...
import 'package:flutter/widgets.dart';
import '../../../../route_manager.dart';
import '../../../instance/get_instance.dart';
import '../../dialog/dialog_route.dart';
import '../../snackbar/snack_route.dart';
import '../default_route.dart';
... ... @@ -96,14 +94,14 @@ class GetObserver extends NavigatorObserver {
final newRoute = _RouteData.ofRoute(route);
if (newRoute.isSnackbar) {
GetConfig.log("OPEN SNACKBAR ${newRoute.name}");
Get.log("OPEN SNACKBAR ${newRoute.name}");
} else if (newRoute.isBottomSheet || newRoute.isDialog) {
GetConfig.log("OPEN ${newRoute.name}");
Get.log("OPEN ${newRoute.name}");
} else if (newRoute.isGetPageRoute) {
GetConfig.log("GOING TO ROUTE ${newRoute.name}");
Get.log("GOING TO ROUTE ${newRoute.name}");
}
GetConfig.currentRoute = newRoute.name;
Get.reference = newRoute.name;
_routeSend?.update((value) {
// Only PageRoute is allowed to change current value
if (route is PageRoute) {
... ... @@ -131,14 +129,14 @@ class GetObserver extends NavigatorObserver {
final newRoute = _RouteData.ofRoute(route);
if (newRoute.isSnackbar) {
GetConfig.log("CLOSE SNACKBAR ${newRoute.name}");
Get.log("CLOSE SNACKBAR ${newRoute.name}");
} else if (newRoute.isBottomSheet || newRoute.isDialog) {
GetConfig.log("CLOSE ${newRoute.name}");
Get.log("CLOSE ${newRoute.name}");
} else if (newRoute.isGetPageRoute) {
GetConfig.log("CLOSE TO ROUTE ${newRoute.name}");
Get.log("CLOSE TO ROUTE ${newRoute.name}");
}
GetConfig.currentRoute = newRoute.name;
Get.reference = newRoute.name;
// Here we use a 'inverse didPush set', meaning that we use
// previous route instead of 'route' because this is
// a 'inverse push'
... ... @@ -167,10 +165,10 @@ class GetObserver extends NavigatorObserver {
final newName = _extractRouteName(newRoute);
final oldName = _extractRouteName(oldRoute);
GetConfig.log("REPLACE ROUTE $oldName");
GetConfig.log("NEW ROUTE $newName");
Get.log("REPLACE ROUTE $oldName");
Get.log("NEW ROUTE $newName");
GetConfig.currentRoute = newName;
Get.reference = newName;
_routeSend?.update((value) {
// Only PageRoute is allowed to change current value
if (newRoute is PageRoute) {
... ... @@ -195,7 +193,7 @@ class GetObserver extends NavigatorObserver {
super.didRemove(route, previousRoute);
final routeName = _extractRouteName(route);
GetConfig.log("REMOVING ROUTE $routeName");
Get.log("REMOVING ROUTE $routeName");
_routeSend?.update((value) {
value.route = previousRoute;
value.isBack = false;
... ...
import 'dart:async';
import 'package:flutter/widgets.dart';
import '../../../core/get_main.dart';
import '../../../instance/get_instance.dart';
import '../../../navigation/root/smart_management.dart';
import '../rx_core/rx_impl.dart';
... ... @@ -52,7 +52,7 @@ class GetImplXState<T extends DisposableInterface> extends State<GetX<T>> {
if (widget.global) {
if (isPrepared) {
if (GetConfig.smartManagement != SmartManagement.keepFactory) {
if (Get.smartManagement != SmartManagement.keepFactory) {
isCreator = true;
}
controller = GetInstance().find<T>(tag: widget.tag);
... ... @@ -70,8 +70,7 @@ class GetImplXState<T extends DisposableInterface> extends State<GetX<T>> {
controller?.onStart();
}
if (widget.initState != null) widget.initState(this);
if (widget.global &&
GetConfig.smartManagement == SmartManagement.onlyBuilder) {
if (widget.global && Get.smartManagement == SmartManagement.onlyBuilder) {
controller?.onStart();
}
subs = _observer.subject.stream.listen((data) => setState(() {}));
... ...
... ... @@ -183,7 +183,7 @@ class Worker {
//final bool _verbose = true;
void _log(String msg) {
// if (!_verbose) return;
GetConfig.log('$runtimeType $type $msg');
Get.log('$runtimeType $type $msg');
}
void dispose() {
... ...
import 'dart:collection';
import 'package:flutter/widgets.dart';
import '../../../state_manager.dart';
import '../../core/get_main.dart';
import '../../instance/get_instance.dart';
import '../../navigation/root/smart_management.dart';
import '../rx/rx_core/rx_interface.dart';
... ... @@ -172,7 +171,7 @@ class _GetBuilderState<T extends GetxController> extends State<GetBuilder<T>>
final isRegistered = GetInstance().isRegistered<T>(tag: widget.tag);
if (isPrepared) {
if (GetConfig.smartManagement != SmartManagement.keepFactory) {
if (Get.smartManagement != SmartManagement.keepFactory) {
isCreator = true;
}
controller = GetInstance().find<T>(tag: widget.tag);
... ... @@ -190,8 +189,7 @@ class _GetBuilderState<T extends GetxController> extends State<GetBuilder<T>>
controller?.onStart();
}
if (widget.global &&
GetConfig.smartManagement == SmartManagement.onlyBuilder) {
if (widget.global && Get.smartManagement == SmartManagement.onlyBuilder) {
controller?.onStart();
}
_subscribeToController();
... ...
import '../../../utils.dart';
import '../regex/get_utils.dart';
import '../get_utils/get_utils.dart';
extension GetDynamicUtils on dynamic {
bool get isNull => GetUtils.isNull(this);
... ...
import 'dart:ui';
import '../regex/get_utils.dart';
import '../get_utils/get_utils.dart';
extension GetNumUtils on num {
bool isLowerThan(num b) => GetUtils.isLowerThan(this, b);
... ...
import '../regex/get_utils.dart';
import '../get_utils/get_utils.dart';
extension GetStringUtils on String {
bool get isNum => GetUtils.isNum(this);
... ...
import '../../../get.dart';
import '../../core/get_main.dart';
/// Returns whether a dynamic value PROBABLY
/// has the isEmpty getter/method by checking
... ... @@ -70,7 +70,7 @@ class GetUtils {
return true;
}
if(value is String) {
if (value is String) {
return value.toString().trim().isEmpty;
}
... ... @@ -372,7 +372,7 @@ class GetUtils {
}
return isLengthGreaterOrEqual(value, minLength) &&
isLengthLowerOrEqual(value, maxLength);
isLengthLessOrEqual(value, maxLength);
}
/// Checks if a contains b (Treating or interpreting upper- and lowercase
... ... @@ -587,6 +587,6 @@ class GetUtils {
String info, {
bool isError = false,
}) {
GetConfig.log('$prefix $value $info'.trim(), isError: isError);
Get.log('$prefix $value $info'.trim(), isError: isError);
}
}
... ...
export 'src/utils/extensions/export.dart';
export 'src/utils/get_utils/get_utils.dart';
export 'src/utils/platform/platform.dart';
export 'src/utils/queue/get_queue.dart';
export 'src/utils/regex/get_utils.dart';
... ...
... ... @@ -7,42 +7,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.2"
version: "2.5.0-nullsafety"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.0-nullsafety.2"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
version: "1.2.0-nullsafety"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.1.0-nullsafety"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.13"
version: "1.15.0-nullsafety.2"
effective_dart:
dependency: "direct dev"
description:
... ... @@ -56,7 +56,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.0-nullsafety"
flutter:
dependency: "direct main"
description: flutter
... ... @@ -73,21 +73,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.8"
version: "0.12.10-nullsafety"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
version: "1.3.0-nullsafety.2"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0-nullsafety"
sky_engine:
dependency: transitive
description: flutter
... ... @@ -99,55 +99,55 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0-nullsafety"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.5"
version: "1.10.0-nullsafety"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "1.1.0-nullsafety"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0-nullsafety"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.17"
version: "0.2.19-nullsafety"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.0-nullsafety.2"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.1.0-nullsafety.2"
sdks:
dart: ">=2.9.0-14.0.dev <3.0.0"
dart: ">=2.10.0-0.0.dev <2.10.0"
... ...