Showing
18 changed files
with
56 additions
and
58 deletions
| 1 | -/// GetX is an extra-light and powerful multiplatform framework. | 1 | +/// GetX is an extra-light and powerful multi-platform framework. |
| 2 | /// It combines high performance state management, intelligent dependency | 2 | /// It combines high performance state management, intelligent dependency |
| 3 | /// injection, and route management in a quick and practical way. | 3 | /// injection, and route management in a quick and practical way. |
| 4 | library get; | 4 | library get; |
| @@ -278,7 +278,7 @@ class GetConnect extends GetConnectInterface { | @@ -278,7 +278,7 @@ class GetConnect extends GetConnectInterface { | ||
| 278 | return baseUrl == null ? url : baseUrl! + url; | 278 | return baseUrl == null ? url : baseUrl! + url; |
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | - /// query allow made GraphQL raw querys | 281 | + /// query allow made GraphQL raw queries |
| 282 | /// final connect = GetConnect(); | 282 | /// final connect = GetConnect(); |
| 283 | /// connect.baseUrl = 'https://countries.trevorblades.com/'; | 283 | /// connect.baseUrl = 'https://countries.trevorblades.com/'; |
| 284 | /// final response = await connect.query( | 284 | /// final response = await connect.query( |
| @@ -132,20 +132,20 @@ class GetHttpClient { | @@ -132,20 +132,20 @@ class GetHttpClient { | ||
| 132 | }); | 132 | }); |
| 133 | var formData = parts.join('&'); | 133 | var formData = parts.join('&'); |
| 134 | bodyBytes = utf8.encode(formData); | 134 | bodyBytes = utf8.encode(formData); |
| 135 | - _setContentLenght(headers, bodyBytes.length); | 135 | + _setContentLength(headers, bodyBytes.length); |
| 136 | headers['content-type'] = contentType; | 136 | headers['content-type'] = contentType; |
| 137 | } else if (body is Map || body is List) { | 137 | } else if (body is Map || body is List) { |
| 138 | var jsonString = json.encode(body); | 138 | var jsonString = json.encode(body); |
| 139 | bodyBytes = utf8.encode(jsonString); | 139 | bodyBytes = utf8.encode(jsonString); |
| 140 | - _setContentLenght(headers, bodyBytes.length); | 140 | + _setContentLength(headers, bodyBytes.length); |
| 141 | headers['content-type'] = contentType ?? defaultContentType; | 141 | headers['content-type'] = contentType ?? defaultContentType; |
| 142 | } else if (body is String) { | 142 | } else if (body is String) { |
| 143 | bodyBytes = utf8.encode(body); | 143 | bodyBytes = utf8.encode(body); |
| 144 | - _setContentLenght(headers, bodyBytes.length); | 144 | + _setContentLength(headers, bodyBytes.length); |
| 145 | 145 | ||
| 146 | headers['content-type'] = contentType ?? defaultContentType; | 146 | headers['content-type'] = contentType ?? defaultContentType; |
| 147 | } else if (body == null) { | 147 | } else if (body == null) { |
| 148 | - _setContentLenght(headers, 0); | 148 | + _setContentLength(headers, 0); |
| 149 | headers['content-type'] = contentType ?? defaultContentType; | 149 | headers['content-type'] = contentType ?? defaultContentType; |
| 150 | } else { | 150 | } else { |
| 151 | if (!errorSafety) { | 151 | if (!errorSafety) { |
| @@ -170,7 +170,7 @@ class GetHttpClient { | @@ -170,7 +170,7 @@ class GetHttpClient { | ||
| 170 | responseInterceptor: responseInterceptor); | 170 | responseInterceptor: responseInterceptor); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | - void _setContentLenght(Map<String, String> headers, int contentLength) { | 173 | + void _setContentLength(Map<String, String> headers, int contentLength) { |
| 174 | if (sendContentLength) { | 174 | if (sendContentLength) { |
| 175 | headers['content-length'] = '$contentLength'; | 175 | headers['content-length'] = '$contentLength'; |
| 176 | } | 176 | } |
| @@ -298,7 +298,6 @@ extension Inst on GetInterface { | @@ -298,7 +298,6 @@ extension Inst on GetInterface { | ||
| 298 | } | 298 | } |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | - | ||
| 302 | /// The findOrNull method will return the instance if it is registered; | 301 | /// The findOrNull method will return the instance if it is registered; |
| 303 | /// otherwise, it will return null. | 302 | /// otherwise, it will return null. |
| 304 | S? findOrNull<S>({String? tag}) { | 303 | S? findOrNull<S>({String? tag}) { |
| @@ -308,7 +307,6 @@ extension Inst on GetInterface { | @@ -308,7 +307,6 @@ extension Inst on GetInterface { | ||
| 308 | return null; | 307 | return null; |
| 309 | } | 308 | } |
| 310 | 309 | ||
| 311 | - | ||
| 312 | /// Replace a parent instance of a class in dependency management | 310 | /// Replace a parent instance of a class in dependency management |
| 313 | /// with a [child] instance | 311 | /// with a [child] instance |
| 314 | /// - [tag] optional, if you use a [tag] to register the Instance. | 312 | /// - [tag] optional, if you use a [tag] to register the Instance. |
| @@ -510,7 +508,7 @@ class _InstanceBuilderFactory<S> { | @@ -510,7 +508,7 @@ class _InstanceBuilderFactory<S> { | ||
| 510 | /// For reusing [dependency] instead of [builderFunc] | 508 | /// For reusing [dependency] instead of [builderFunc] |
| 511 | bool? isSingleton; | 509 | bool? isSingleton; |
| 512 | 510 | ||
| 513 | - /// When fenix mode is avaliable, when a new instance is need | 511 | + /// When fenix mode is available, when a new instance is need |
| 514 | /// Instance manager will recreate a new instance of S | 512 | /// Instance manager will recreate a new instance of S |
| 515 | bool fenix; | 513 | bool fenix; |
| 516 | 514 |
| @@ -39,7 +39,7 @@ mixin GetLifeCycleMixin { | @@ -39,7 +39,7 @@ mixin GetLifeCycleMixin { | ||
| 39 | bool get initialized => _initialized; | 39 | bool get initialized => _initialized; |
| 40 | 40 | ||
| 41 | /// Called at the exact moment the widget is allocated in memory. | 41 | /// Called at the exact moment the widget is allocated in memory. |
| 42 | - /// It uses an internal "callable" type, to avoid any @overrides in subclases. | 42 | + /// It uses an internal "callable" type, to avoid any @overrides in subclasses. |
| 43 | /// This method should be internal and is required to define the | 43 | /// This method should be internal and is required to define the |
| 44 | /// lifetime cycle of the subclass. | 44 | /// lifetime cycle of the subclass. |
| 45 | // @protected | 45 | // @protected |
| @@ -575,7 +575,7 @@ extension GetNavigationExt on GetInterface { | @@ -575,7 +575,7 @@ extension GetNavigationExt on GetInterface { | ||
| 575 | /// By default, GetX will prevent you from push a route that you already in, | 575 | /// By default, GetX will prevent you from push a route that you already in, |
| 576 | /// if you want to push anyway, set [preventDuplicates] to false | 576 | /// if you want to push anyway, set [preventDuplicates] to false |
| 577 | /// | 577 | /// |
| 578 | - /// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors | 578 | + /// Note: Always put a slash on the route ('/page1'), to avoid unexpected errors |
| 579 | Future<T?>? toNamed<T>( | 579 | Future<T?>? toNamed<T>( |
| 580 | String page, { | 580 | String page, { |
| 581 | dynamic arguments, | 581 | dynamic arguments, |
| @@ -616,7 +616,7 @@ extension GetNavigationExt on GetInterface { | @@ -616,7 +616,7 @@ extension GetNavigationExt on GetInterface { | ||
| 616 | /// By default, GetX will prevent you from push a route that you already in, | 616 | /// By default, GetX will prevent you from push a route that you already in, |
| 617 | /// if you want to push anyway, set [preventDuplicates] to false | 617 | /// if you want to push anyway, set [preventDuplicates] to false |
| 618 | /// | 618 | /// |
| 619 | - /// Note: Always put a slash on the route ('/page1'), to avoid unnexpected errors | 619 | + /// Note: Always put a slash on the route ('/page1'), to avoid unexpected errors |
| 620 | Future<T?>? offNamed<T>( | 620 | Future<T?>? offNamed<T>( |
| 621 | String page, { | 621 | String page, { |
| 622 | dynamic arguments, | 622 | dynamic arguments, |
| @@ -1005,7 +1005,7 @@ extension GetNavigationExt on GetInterface { | @@ -1005,7 +1005,7 @@ extension GetNavigationExt on GetInterface { | ||
| 1005 | String _cleanRouteName(String name) { | 1005 | String _cleanRouteName(String name) { |
| 1006 | name = name.replaceAll('() => ', ''); | 1006 | name = name.replaceAll('() => ', ''); |
| 1007 | 1007 | ||
| 1008 | - /// uncommonent for URL styling. | 1008 | + /// uncomment for URL styling. |
| 1009 | // name = name.paramCase!; | 1009 | // name = name.paramCase!; |
| 1010 | if (!name.startsWith('/')) { | 1010 | if (!name.startsWith('/')) { |
| 1011 | name = '/$name'; | 1011 | name = '/$name'; |
| @@ -518,7 +518,7 @@ class GetRootState extends State<GetRoot> with WidgetsBindingObserver { | @@ -518,7 +518,7 @@ class GetRootState extends State<GetRoot> with WidgetsBindingObserver { | ||
| 518 | () => GetDelegate( | 518 | () => GetDelegate( |
| 519 | showHashOnUrl: true, | 519 | showHashOnUrl: true, |
| 520 | //debugLabel: 'Getx nested key: ${key.toString()}', | 520 | //debugLabel: 'Getx nested key: ${key.toString()}', |
| 521 | - pages: RouteDecoder.fromRoute(key).currentChildrens ?? [], | 521 | + pages: RouteDecoder.fromRoute(key).currentChildren ?? [], |
| 522 | ), | 522 | ), |
| 523 | ); | 523 | ); |
| 524 | return keys[key]; | 524 | return keys[key]; |
| @@ -532,7 +532,7 @@ class GetRootState extends State<GetRoot> with WidgetsBindingObserver { | @@ -532,7 +532,7 @@ class GetRootState extends State<GetRoot> with WidgetsBindingObserver { | ||
| 532 | String cleanRouteName(String name) { | 532 | String cleanRouteName(String name) { |
| 533 | name = name.replaceAll('() => ', ''); | 533 | name = name.replaceAll('() => ', ''); |
| 534 | 534 | ||
| 535 | - /// uncommonent for URL styling. | 535 | + /// uncomment for URL styling. |
| 536 | // name = name.paramCase!; | 536 | // name = name.paramCase!; |
| 537 | if (!name.startsWith('/')) { | 537 | if (!name.startsWith('/')) { |
| 538 | name = '/$name'; | 538 | name = '/$name'; |
| @@ -37,12 +37,12 @@ class RouterReportManager<T> { | @@ -37,12 +37,12 @@ class RouterReportManager<T> { | ||
| 37 | 37 | ||
| 38 | /// Links a Class instance [S] (or [tag]) to the current route. | 38 | /// Links a Class instance [S] (or [tag]) to the current route. |
| 39 | /// Requires usage of `GetMaterialApp`. | 39 | /// Requires usage of `GetMaterialApp`. |
| 40 | - void reportDependencyLinkedToRoute(String depedencyKey) { | 40 | + void reportDependencyLinkedToRoute(String dependencyKey) { |
| 41 | if (_current == null) return; | 41 | if (_current == null) return; |
| 42 | if (_routesKey.containsKey(_current)) { | 42 | if (_routesKey.containsKey(_current)) { |
| 43 | - _routesKey[_current!]!.add(depedencyKey); | 43 | + _routesKey[_current!]!.add(dependencyKey); |
| 44 | } else { | 44 | } else { |
| 45 | - _routesKey[_current] = <String>[depedencyKey]; | 45 | + _routesKey[_current] = <String>[dependencyKey]; |
| 46 | } | 46 | } |
| 47 | } | 47 | } |
| 48 | 48 |
| @@ -119,10 +119,10 @@ class GetPageRoute<T> extends PageRoute<T> | @@ -119,10 +119,10 @@ class GetPageRoute<T> extends PageRoute<T> | ||
| 119 | if (_child != null) return _child!; | 119 | if (_child != null) return _child!; |
| 120 | final middlewareRunner = MiddlewareRunner(middlewares); | 120 | final middlewareRunner = MiddlewareRunner(middlewares); |
| 121 | 121 | ||
| 122 | - final localbinds = [if (binds != null) ...binds!]; | 122 | + final localBinds = [if (binds != null) ...binds!]; |
| 123 | 123 | ||
| 124 | final bindingsToBind = middlewareRunner | 124 | final bindingsToBind = middlewareRunner |
| 125 | - .runOnBindingsStart(bindings.isNotEmpty ? bindings : localbinds); | 125 | + .runOnBindingsStart(bindings.isNotEmpty ? bindings : localBinds); |
| 126 | 126 | ||
| 127 | final pageToBuild = middlewareRunner.runOnPageBuildStart(page)!; | 127 | final pageToBuild = middlewareRunner.runOnPageBuildStart(page)!; |
| 128 | 128 |
| @@ -290,7 +290,7 @@ class GetDelegate extends RouterDelegate<RouteDecoder> | @@ -290,7 +290,7 @@ class GetDelegate extends RouterDelegate<RouteDecoder> | ||
| 290 | final res = currentHistory!.currentTreeBranch | 290 | final res = currentHistory!.currentTreeBranch |
| 291 | .where((r) => r.participatesInRootNavigator != null); | 291 | .where((r) => r.participatesInRootNavigator != null); |
| 292 | if (res.isEmpty) { | 292 | if (res.isEmpty) { |
| 293 | - //default behavoir, all routes participate in root navigator | 293 | + //default behavior, all routes participate in root navigator |
| 294 | return _activePages.map((e) => e.route!); | 294 | return _activePages.map((e) => e.route!); |
| 295 | } else { | 295 | } else { |
| 296 | //user specified at least one participatesInRootNavigator | 296 | //user specified at least one participatesInRootNavigator |
| @@ -603,7 +603,7 @@ class GetDelegate extends RouterDelegate<RouteDecoder> | @@ -603,7 +603,7 @@ class GetDelegate extends RouterDelegate<RouteDecoder> | ||
| 603 | } | 603 | } |
| 604 | 604 | ||
| 605 | /// Removes routes according to [PopMode] | 605 | /// Removes routes according to [PopMode] |
| 606 | - /// until it reaches the specifc [fullRoute], | 606 | + /// until it reaches the specific [fullRoute], |
| 607 | /// DOES NOT remove the [fullRoute] | 607 | /// DOES NOT remove the [fullRoute] |
| 608 | @override | 608 | @override |
| 609 | Future<void> popModeUntil( | 609 | Future<void> popModeUntil( |
| @@ -666,7 +666,7 @@ class GetDelegate extends RouterDelegate<RouteDecoder> | @@ -666,7 +666,7 @@ class GetDelegate extends RouterDelegate<RouteDecoder> | ||
| 666 | String _cleanRouteName(String name) { | 666 | String _cleanRouteName(String name) { |
| 667 | name = name.replaceAll('() => ', ''); | 667 | name = name.replaceAll('() => ', ''); |
| 668 | 668 | ||
| 669 | - /// uncommonent for URL styling. | 669 | + /// uncomment for URL styling. |
| 670 | // name = name.paramCase!; | 670 | // name = name.paramCase!; |
| 671 | if (!name.startsWith('/')) { | 671 | if (!name.startsWith('/')) { |
| 672 | name = '/$name'; | 672 | name = '/$name'; |
| @@ -39,7 +39,7 @@ class RouteDecoder { | @@ -39,7 +39,7 @@ class RouteDecoder { | ||
| 39 | } | 39 | } |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | - List<GetPage>? get currentChildrens => route?.children; | 42 | + List<GetPage>? get currentChildren => route?.children; |
| 43 | 43 | ||
| 44 | Map<String, String> get parameters => pageSettings?.params ?? {}; | 44 | Map<String, String> get parameters => pageSettings?.params ?? {}; |
| 45 | 45 |
| @@ -8,7 +8,7 @@ mixin RxObjectMixin<T> on GetListenable<T> { | @@ -8,7 +8,7 @@ mixin RxObjectMixin<T> on GetListenable<T> { | ||
| 8 | //late T _value; | 8 | //late T _value; |
| 9 | 9 | ||
| 10 | /// Makes a direct update of [value] adding it to the Stream | 10 | /// Makes a direct update of [value] adding it to the Stream |
| 11 | - /// useful when you make use of Rx for custom Types to referesh your UI. | 11 | + /// useful when you make use of Rx for custom Types to refresh your UI. |
| 12 | /// | 12 | /// |
| 13 | /// Sample: | 13 | /// Sample: |
| 14 | /// ``` | 14 | /// ``` |
| @@ -110,9 +110,9 @@ class ResponsiveScreen { | @@ -110,9 +110,9 @@ class ResponsiveScreen { | ||
| 110 | late BuildContext context; | 110 | late BuildContext context; |
| 111 | final ResponsiveScreenSettings settings; | 111 | final ResponsiveScreenSettings settings; |
| 112 | 112 | ||
| 113 | - late bool _isPaltformDesktop; | 113 | + late bool _isPlatformDesktop; |
| 114 | ResponsiveScreen(this.settings) { | 114 | ResponsiveScreen(this.settings) { |
| 115 | - _isPaltformDesktop = GetPlatform.isDesktop; | 115 | + _isPlatformDesktop = GetPlatform.isDesktop; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | double get height => context.height; | 118 | double get height => context.height; |
| @@ -130,15 +130,15 @@ class ResponsiveScreen { | @@ -130,15 +130,15 @@ class ResponsiveScreen { | ||
| 130 | /// Is [screenType] [ScreenType.Watch] | 130 | /// Is [screenType] [ScreenType.Watch] |
| 131 | bool get isWatch => (screenType == ScreenType.watch); | 131 | bool get isWatch => (screenType == ScreenType.watch); |
| 132 | 132 | ||
| 133 | - double get _getdeviceWidth { | ||
| 134 | - if (_isPaltformDesktop) { | 133 | + double get _getDeviceWidth { |
| 134 | + if (_isPlatformDesktop) { | ||
| 135 | return width; | 135 | return width; |
| 136 | } | 136 | } |
| 137 | return context.mediaQueryShortestSide; | 137 | return context.mediaQueryShortestSide; |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | ScreenType get screenType { | 140 | ScreenType get screenType { |
| 141 | - final deviceWidth = _getdeviceWidth; | 141 | + final deviceWidth = _getDeviceWidth; |
| 142 | if (deviceWidth >= settings.desktopChangePoint) return ScreenType.desktop; | 142 | if (deviceWidth >= settings.desktopChangePoint) return ScreenType.desktop; |
| 143 | if (deviceWidth >= settings.tabletChangePoint) return ScreenType.tablet; | 143 | if (deviceWidth >= settings.tabletChangePoint) return ScreenType.tablet; |
| 144 | if (deviceWidth < settings.watchChangePoint) return ScreenType.watch; | 144 | if (deviceWidth < settings.watchChangePoint) return ScreenType.watch; |
| @@ -5,12 +5,12 @@ extension ContextExt on BuildContext { | @@ -5,12 +5,12 @@ extension ContextExt on BuildContext { | ||
| 5 | Size get mediaQuerySize => MediaQuery.of(this).size; | 5 | Size get mediaQuerySize => MediaQuery.of(this).size; |
| 6 | 6 | ||
| 7 | /// The same of [MediaQuery.of(context).size.height] | 7 | /// The same of [MediaQuery.of(context).size.height] |
| 8 | - /// Note: updates when you rezise your screen (like on a browser or | 8 | + /// Note: updates when you resize your screen (like on a browser or |
| 9 | /// desktop window) | 9 | /// desktop window) |
| 10 | double get height => mediaQuerySize.height; | 10 | double get height => mediaQuerySize.height; |
| 11 | 11 | ||
| 12 | /// The same of [MediaQuery.of(context).size.width] | 12 | /// The same of [MediaQuery.of(context).size.width] |
| 13 | - /// Note: updates when you rezise your screen (like on a browser or | 13 | + /// Note: updates when you resize your screen (like on a browser or |
| 14 | /// desktop window) | 14 | /// desktop window) |
| 15 | double get width => mediaQuerySize.width; | 15 | double get width => mediaQuerySize.width; |
| 16 | 16 |
| @@ -70,7 +70,7 @@ extension GetStringUtils on String { | @@ -70,7 +70,7 @@ extension GetStringUtils on String { | ||
| 70 | /// Discover if the String is a SHA256 Hash | 70 | /// Discover if the String is a SHA256 Hash |
| 71 | bool get isSHA256 => GetUtils.isSHA256(this); | 71 | bool get isSHA256 => GetUtils.isSHA256(this); |
| 72 | 72 | ||
| 73 | - /// Discover if the String is a bynary value | 73 | + /// Discover if the String is a binary value |
| 74 | bool get isBinary => GetUtils.isBinary(this); | 74 | bool get isBinary => GetUtils.isBinary(this); |
| 75 | 75 | ||
| 76 | /// Discover if the String is a ipv4 | 76 | /// Discover if the String is a ipv4 |
| @@ -81,8 +81,8 @@ extension GetStringUtils on String { | @@ -81,8 +81,8 @@ extension GetStringUtils on String { | ||
| 81 | /// Discover if the String is a Hexadecimal | 81 | /// Discover if the String is a Hexadecimal |
| 82 | bool get isHexadecimal => GetUtils.isHexadecimal(this); | 82 | bool get isHexadecimal => GetUtils.isHexadecimal(this); |
| 83 | 83 | ||
| 84 | - /// Discover if the String is a palindrom | ||
| 85 | - bool get isPalindrom => GetUtils.isPalindrom(this); | 84 | + /// Discover if the String is a palindrome |
| 85 | + bool get isPalindrome => GetUtils.isPalindrome(this); | ||
| 86 | 86 | ||
| 87 | /// Discover if the String is a passport number | 87 | /// Discover if the String is a passport number |
| 88 | bool get isPassport => GetUtils.isPassport(this); | 88 | bool get isPassport => GetUtils.isPassport(this); |
| @@ -64,10 +64,10 @@ class GetUtils { | @@ -64,10 +64,10 @@ class GetUtils { | ||
| 64 | 64 | ||
| 65 | /// In dart2js (in flutter v1.17) a var by default is undefined. | 65 | /// In dart2js (in flutter v1.17) a var by default is undefined. |
| 66 | /// *Use this only if you are in version <- 1.17*. | 66 | /// *Use this only if you are in version <- 1.17*. |
| 67 | - /// So we assure the null type in json convertions to avoid the | 67 | + /// So we assure the null type in json conversions to avoid the |
| 68 | /// "value":value==null?null:value; someVar.nil will force the null type | 68 | /// "value":value==null?null:value; someVar.nil will force the null type |
| 69 | /// if the var is null or undefined. | 69 | /// if the var is null or undefined. |
| 70 | - /// `nil` taken from ObjC just to have a shorter sintax. | 70 | + /// `nil` taken from ObjC just to have a shorter syntax. |
| 71 | static dynamic nil(dynamic s) => s; | 71 | static dynamic nil(dynamic s) => s; |
| 72 | 72 | ||
| 73 | /// Checks if data is null or blank (empty or only contains whitespace). | 73 | /// Checks if data is null or blank (empty or only contains whitespace). |
| @@ -103,7 +103,7 @@ class GetUtils { | @@ -103,7 +103,7 @@ class GetUtils { | ||
| 103 | static bool isAlphabetOnly(String s) => hasMatch(s, r'^[a-zA-Z]+$'); | 103 | static bool isAlphabetOnly(String s) => hasMatch(s, r'^[a-zA-Z]+$'); |
| 104 | 104 | ||
| 105 | /// Checks if string contains at least one Capital Letter | 105 | /// Checks if string contains at least one Capital Letter |
| 106 | - static bool hasCapitalletter(String s) => hasMatch(s, r'[A-Z]'); | 106 | + static bool hasCapitalLetter(String s) => hasMatch(s, r'[A-Z]'); |
| 107 | 107 | ||
| 108 | /// Checks if string is boolean. | 108 | /// Checks if string is boolean. |
| 109 | static bool isBool(String value) { | 109 | static bool isBool(String value) { |
| @@ -253,8 +253,8 @@ class GetUtils { | @@ -253,8 +253,8 @@ class GetUtils { | ||
| 253 | static bool isHexadecimal(String s) => | 253 | static bool isHexadecimal(String s) => |
| 254 | hasMatch(s, r'^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$'); | 254 | hasMatch(s, r'^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$'); |
| 255 | 255 | ||
| 256 | - /// Checks if string is Palindrom. | ||
| 257 | - static bool isPalindrom(String string) { | 256 | + /// Checks if string is Palindrome. |
| 257 | + static bool isPalindrome(String string) { | ||
| 258 | final cleanString = string | 258 | final cleanString = string |
| 259 | .toLowerCase() | 259 | .toLowerCase() |
| 260 | .replaceAll(RegExp(r"\s+"), '') | 260 | .replaceAll(RegExp(r"\s+"), '') |
| @@ -397,25 +397,25 @@ class GetUtils { | @@ -397,25 +397,25 @@ class GetUtils { | ||
| 397 | /// Checks if num a EQUAL than num b. | 397 | /// Checks if num a EQUAL than num b. |
| 398 | static bool isEqual(num a, num b) => a == b; | 398 | static bool isEqual(num a, num b) => a == b; |
| 399 | 399 | ||
| 400 | - //Check if num is a cnpj | 400 | + // Checks if num is a cnpj |
| 401 | static bool isCnpj(String cnpj) { | 401 | static bool isCnpj(String cnpj) { |
| 402 | - // Obter somente os números do CNPJ | 402 | + // Get only the numbers from the CNPJ |
| 403 | final numbers = cnpj.replaceAll(RegExp(r'[^0-9]'), ''); | 403 | final numbers = cnpj.replaceAll(RegExp(r'[^0-9]'), ''); |
| 404 | 404 | ||
| 405 | - // Testar se o CNPJ possui 14 dígitos | 405 | + // Test if the CNPJ has 14 digits |
| 406 | if (numbers.length != 14) { | 406 | if (numbers.length != 14) { |
| 407 | return false; | 407 | return false; |
| 408 | } | 408 | } |
| 409 | 409 | ||
| 410 | - // Testar se todos os dígitos do CNPJ são iguais | 410 | + // Test if all digits of the CNPJ are the same |
| 411 | if (RegExp(r'^(\d)\1*$').hasMatch(numbers)) { | 411 | if (RegExp(r'^(\d)\1*$').hasMatch(numbers)) { |
| 412 | return false; | 412 | return false; |
| 413 | } | 413 | } |
| 414 | 414 | ||
| 415 | - // Dividir dígitos | 415 | + // Divide digits |
| 416 | final digits = numbers.split('').map(int.parse).toList(); | 416 | final digits = numbers.split('').map(int.parse).toList(); |
| 417 | 417 | ||
| 418 | - // Calcular o primeiro dígito verificador | 418 | + // Calculate the first check digit |
| 419 | var calcDv1 = 0; | 419 | var calcDv1 = 0; |
| 420 | var j = 0; | 420 | var j = 0; |
| 421 | for (var i in Iterable<int>.generate(12, (i) => i < 4 ? 5 - i : 13 - i)) { | 421 | for (var i in Iterable<int>.generate(12, (i) => i < 4 ? 5 - i : 13 - i)) { |
| @@ -424,12 +424,12 @@ class GetUtils { | @@ -424,12 +424,12 @@ class GetUtils { | ||
| 424 | calcDv1 %= 11; | 424 | calcDv1 %= 11; |
| 425 | final dv1 = calcDv1 < 2 ? 0 : 11 - calcDv1; | 425 | final dv1 = calcDv1 < 2 ? 0 : 11 - calcDv1; |
| 426 | 426 | ||
| 427 | - // Testar o primeiro dígito verificado | 427 | + // Test the first check digit |
| 428 | if (digits[12] != dv1) { | 428 | if (digits[12] != dv1) { |
| 429 | return false; | 429 | return false; |
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | - // Calcular o segundo dígito verificador | 432 | + // Calculate the second check digit |
| 433 | var calcDv2 = 0; | 433 | var calcDv2 = 0; |
| 434 | j = 0; | 434 | j = 0; |
| 435 | for (var i in Iterable<int>.generate(13, (i) => i < 5 ? 6 - i : 14 - i)) { | 435 | for (var i in Iterable<int>.generate(13, (i) => i < 5 ? 6 - i : 14 - i)) { |
| @@ -438,7 +438,7 @@ class GetUtils { | @@ -438,7 +438,7 @@ class GetUtils { | ||
| 438 | calcDv2 %= 11; | 438 | calcDv2 %= 11; |
| 439 | final dv2 = calcDv2 < 2 ? 0 : 11 - calcDv2; | 439 | final dv2 = calcDv2 < 2 ? 0 : 11 - calcDv2; |
| 440 | 440 | ||
| 441 | - // Testar o segundo dígito verificador | 441 | + // Test the second check digit |
| 442 | if (digits[13] != dv2) { | 442 | if (digits[13] != dv2) { |
| 443 | return false; | 443 | return false; |
| 444 | } | 444 | } |
| @@ -517,7 +517,7 @@ class GetUtils { | @@ -517,7 +517,7 @@ class GetUtils { | ||
| 517 | return value.replaceAll(' ', ''); | 517 | return value.replaceAll(' ', ''); |
| 518 | } | 518 | } |
| 519 | 519 | ||
| 520 | - /// Camelcase string | 520 | + /// camelCase string |
| 521 | /// Example: your name => yourName | 521 | /// Example: your name => yourName |
| 522 | static String? camelCase(String value) { | 522 | static String? camelCase(String value) { |
| 523 | if (isNullOrBlank(value)!) { | 523 | if (isNullOrBlank(value)!) { |
| @@ -576,7 +576,7 @@ class GetUtils { | @@ -576,7 +576,7 @@ class GetUtils { | ||
| 576 | 576 | ||
| 577 | /// Extract numeric value of string | 577 | /// Extract numeric value of string |
| 578 | /// Example: OTP 12312 27/04/2020 => 1231227042020ß | 578 | /// Example: OTP 12312 27/04/2020 => 1231227042020ß |
| 579 | - /// If firstword only is true, then the example return is "12312" | 579 | + /// If firstWordOnly is true, then the example return is "12312" |
| 580 | /// (first found numeric word) | 580 | /// (first found numeric word) |
| 581 | static String numericOnly(String s, {bool firstWordOnly = false}) { | 581 | static String numericOnly(String s, {bool firstWordOnly = false}) { |
| 582 | var numericOnlyStr = ''; | 582 | var numericOnlyStr = ''; |
| @@ -9,7 +9,7 @@ class OtimizedListView<T> extends StatelessWidget { | @@ -9,7 +9,7 @@ class OtimizedListView<T> extends StatelessWidget { | ||
| 9 | final ScrollPhysics? physics; | 9 | final ScrollPhysics? physics; |
| 10 | final bool shrinkWrap; | 10 | final bool shrinkWrap; |
| 11 | final Widget onEmpty; | 11 | final Widget onEmpty; |
| 12 | - final int lenght; | 12 | + final int length; |
| 13 | final Widget Function(BuildContext context, ValueKey key, T item) builder; | 13 | final Widget Function(BuildContext context, ValueKey key, T item) builder; |
| 14 | const OtimizedListView({ | 14 | const OtimizedListView({ |
| 15 | Key? key, | 15 | Key? key, |
| @@ -22,7 +22,7 @@ class OtimizedListView<T> extends StatelessWidget { | @@ -22,7 +22,7 @@ class OtimizedListView<T> extends StatelessWidget { | ||
| 22 | this.physics, | 22 | this.physics, |
| 23 | this.onEmpty = const SizedBox.shrink(), | 23 | this.onEmpty = const SizedBox.shrink(), |
| 24 | this.shrinkWrap = false, | 24 | this.shrinkWrap = false, |
| 25 | - }) : lenght = list.length, | 25 | + }) : length = list.length, |
| 26 | super(key: key); | 26 | super(key: key); |
| 27 | @override | 27 | @override |
| 28 | Widget build(BuildContext context) { | 28 | Widget build(BuildContext context) { |
| @@ -555,7 +555,7 @@ void main() { | @@ -555,7 +555,7 @@ void main() { | ||
| 555 | 555 | ||
| 556 | expect(alphaNumeric.isHexadecimal, false); | 556 | expect(alphaNumeric.isHexadecimal, false); |
| 557 | }); | 557 | }); |
| 558 | - test('var.isPalindrom', () { | 558 | + test('var.isPalindrome', () { |
| 559 | final palindroms = [ | 559 | final palindroms = [ |
| 560 | 'Anna', | 560 | 'Anna', |
| 561 | 'Civic', | 561 | 'Civic', |
| @@ -584,7 +584,7 @@ void main() { | @@ -584,7 +584,7 @@ void main() { | ||
| 584 | 'A dama admirou o rim da amada.', | 584 | 'A dama admirou o rim da amada.', |
| 585 | 'A Daniela ama a lei? Nada!', | 585 | 'A Daniela ama a lei? Nada!', |
| 586 | 586 | ||
| 587 | - // TODO make isPalindrom regex support UTF8 characters | 587 | + // TODO make isPalindrome regex support UTF8 characters |
| 588 | // 'Adias a data da saída.', | 588 | // 'Adias a data da saída.', |
| 589 | // 'A diva em Argel alegra-me a vida.', | 589 | // 'A diva em Argel alegra-me a vida.', |
| 590 | // 'A droga do dote é todo da gorda.', | 590 | // 'A droga do dote é todo da gorda.', |
| @@ -607,9 +607,9 @@ void main() { | @@ -607,9 +607,9 @@ void main() { | ||
| 607 | ]; | 607 | ]; |
| 608 | for (final palindrom in palindroms) { | 608 | for (final palindrom in palindroms) { |
| 609 | // print("testing $palindrom"); | 609 | // print("testing $palindrom"); |
| 610 | - expect(palindrom.isPalindrom, true); | 610 | + expect(palindrom.isPalindrome, true); |
| 611 | } | 611 | } |
| 612 | - expect(alphaNumeric.isPalindrom, false); | 612 | + expect(alphaNumeric.isPalindrome, false); |
| 613 | }); | 613 | }); |
| 614 | test('var.isPassport', () { | 614 | test('var.isPassport', () { |
| 615 | final passports = [ | 615 | final passports = [ |
-
Please register or login to post a comment