Skip to content

Commit ebc9df1

Browse files
authored
Merge pull request #378 from kuhnroyal/fix/typos
Fix typos
2 parents d6cc02f + 3602eda commit ebc9df1

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

lib/get_it.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ abstract mixin class ShadowChangeHandlers {
3030

3131
/// If objects that are registered inside GetIt implements [Disposable] the
3232
/// [onDispose] method will be called whenever that Object is unregistered,
33-
/// resetted or its enclosing Scope is popped
33+
/// reset or its enclosing Scope is popped
3434
abstract mixin class Disposable {
3535
FutureOr onDispose();
3636
}
@@ -153,7 +153,7 @@ abstract class GetIt {
153153
bool allowReassignment = false;
154154

155155
/// By default it's throws error when [allowReassignment]= false. and trying to register same type
156-
/// If you really need, you can disable the Asserts / Errror by setting[skipDoubleRegistration]= true
156+
/// If you really need, you can disable the Asserts / Error by setting[skipDoubleRegistration]= true
157157
@visibleForTesting
158158
bool skipDoubleRegistration = false;
159159

@@ -343,24 +343,24 @@ abstract class GetIt {
343343
///
344344
/// [registerSingletonIfAbsent] and [releaseInstance] are used to manage the lifecycle of
345345
/// a Singleton. This is useful if you register an object when you push a Page and this page can get
346-
/// pused recursively. In that case you don't want to dispose the object when first of these pages is popped
346+
/// pushed recursively. In that case you don't want to dispose the object when first of these pages is popped
347347
///
348348
349349
/// Only registers a type new as Singleton if it is not already registered. Otherwise it returns
350350
/// the existing instance and increments an internal reference counter to ensure that matching
351351
/// [unregister] or [releaseInstance] calls will decrement the reference counter an won't unregister
352352
/// and dispose the registration as long as the reference counter is > 0.
353353
/// [T] type/interface that is used for the registration and the access via [get]
354-
/// [factoryFunc] that is callled to create the instance if it is not already registered
354+
/// [factoryFunc] that is called to create the instance if it is not already registered
355355
/// [instanceName] optional key to register more than one instance of one type
356-
/// [dispose] disposing function that is autmatically called before the object is removed from get_it
356+
/// [dispose] disposing function that is automatically called before the object is removed from get_it
357357
T registerSingletonIfAbsent<T extends Object>(
358358
T Function() factoryFunc, {
359359
String? instanceName,
360360
DisposingFunc<T>? dispose,
361361
});
362362

363-
/// checks if a regiserter Singleton has an reference counter > 0
363+
/// checks if a registered Singleton has an reference counter > 0
364364
/// if so it decrements the reference counter and if it reaches 0 it
365365
/// unregisters the Singleton
366366
/// if called on an object that's reference counter was never incremented
@@ -576,7 +576,7 @@ abstract class GetIt {
576576
/// [instanceName] if you need to dispose any resources you can do it using
577577
/// [disposingFunction] function that provides an instance of your class to be disposed.
578578
/// This function overrides the disposing you might have provided when registering.
579-
/// If you have enabled referece counting when registering, [unregister] will only unregister and dispose the object
579+
/// If you have enabled reference counting when registering, [unregister] will only unregister and dispose the object
580580
/// if referenceCount is 0
581581
/// [ignoreReferenceCount] if `true` it will ignore the reference count and unregister the object
582582
/// only use this if you know what you are doing

lib/get_it_impl.dart

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ enum _ServiceFactoryType {
3838
alwaysNew, // factory which means on every call of [get] a new instance is created
3939
constant, // normal singleton
4040
lazy, // lazy
41-
cachedFactory, // cached factoryj
41+
cachedFactory, // cached factory
4242
}
4343

4444
/// If I use `Singleton` without specifier in the comments I mean normal and lazy
@@ -114,7 +114,7 @@ class _ServiceFactory<T extends Object, P1, P2> {
114114

115115
final bool shouldSignalReady;
116116

117-
int _refenceCount = 0;
117+
int _referenceCount = 0;
118118

119119
_ServiceFactory(
120120
this._getItInstance,
@@ -251,7 +251,7 @@ class _ServiceFactory<T extends Object, P1, P2> {
251251
}
252252

253253
/// returns an async instance depending on the type of the registration if [async==true] or
254-
/// if [dependsOn.isnoEmpty].
254+
/// if [dependsOn.isNotEmpty].
255255
Future<R> getObjectAsync<R>(dynamic param1, dynamic param2) async {
256256
assert(
257257
!(factoryType != _ServiceFactoryType.alwaysNew &&
@@ -512,7 +512,7 @@ class _GetItImplementation implements GetIt {
512512
bool allowReassignment = false;
513513

514514
/// By default it's throws error when [allowReassignment]= false. and trying to register same type
515-
/// If you really need, you can disable the Asserts / Errror by setting[skipDoubleRegistration]= true
515+
/// If you really need, you can disable the Asserts / Error by setting[skipDoubleRegistration]= true
516516
@visibleForTesting
517517
@override
518518
bool skipDoubleRegistration = false;
@@ -943,9 +943,9 @@ class _GetItImplementation implements GetIt {
943943
/// [unregister] or [releaseInstance] calls will decrement the reference counter an won't unregister
944944
/// and dispose the registration as long as the reference counter is > 0.
945945
/// [T] type/interface that is used for the registration and the access via [get]
946-
/// [factoryFunc] that is callled to create the instance if it is not already registered
946+
/// [factoryFunc] that is called to create the instance if it is not already registered
947947
/// [instanceName] optional key to register more than one instance of one type
948-
/// [dispose] disposing function that is autmatically called before the object is removed from get_it
948+
/// [dispose] disposing function that is automatically called before the object is removed from get_it
949949
@override
950950
T registerSingletonIfAbsent<T extends Object>(
951951
T Function() factoryFunc, {
@@ -960,7 +960,7 @@ class _GetItImplementation implements GetIt {
960960
!existingFactory.isAsync,
961961
StateError(
962962
'registerSingletonIfAbsent can only be called for a type that is already registered as Singleton and not for factories or async/lazy Singletons'));
963-
existingFactory._refenceCount++;
963+
existingFactory._referenceCount++;
964964
return existingFactory.instance!;
965965
}
966966

@@ -976,20 +976,20 @@ class _GetItImplementation implements GetIt {
976976
return instance;
977977
}
978978

979-
/// checks if a regiserter Singleton has an reference counter > 0
979+
/// checks if a registered Singleton has an reference counter > 0
980980
/// if so it decrements the reference counter and if it reaches 0 it
981981
/// unregisters the Singleton
982982
/// if called on an object that's reference counter was never incremented
983983
/// it will immediately unregister and dispose the object
984984
@override
985985
void releaseInstance(Object instance) {
986-
final registerdFactory = _findFactoryByInstance(instance);
987-
if (registerdFactory._refenceCount < 1) {
988-
assert(registerdFactory._refenceCount == 0,
986+
final registeredFactory = _findFactoryByInstance(instance);
987+
if (registeredFactory._referenceCount < 1) {
988+
assert(registeredFactory._referenceCount == 0,
989989
'GetIt: releaseInstance was called on an object that was already released');
990990
unregister(instance: instance);
991991
} else {
992-
registerdFactory._refenceCount--;
992+
registeredFactory._referenceCount--;
993993
}
994994
}
995995

@@ -1110,8 +1110,8 @@ class _GetItImplementation implements GetIt {
11101110
/// Unregister an instance of an object or a factory/singleton by Type [T] or by name [instanceName]
11111111
/// if you need to dispose any resources you can pass in a [disposingFunction] function
11121112
/// that provides an instance of your class to be disposed
1113-
/// If you have provided an disposing functin when you registered the object that one will be called automatically
1114-
/// If you have enabled referece counting when registering, [unregister] will only unregister and dispose the object
1113+
/// If you have provided an disposing function when you registered the object that one will be called automatically
1114+
/// If you have enabled reference counting when registering, [unregister] will only unregister and dispose the object
11151115
/// if referenceCount is 0
11161116
///
11171117
@override
@@ -1132,8 +1132,8 @@ class _GetItImplementation implements GetIt {
11321132
),
11331133
);
11341134

1135-
if (factoryToRemove._refenceCount > 0) {
1136-
factoryToRemove._refenceCount--;
1135+
if (factoryToRemove._referenceCount > 0) {
1136+
factoryToRemove._referenceCount--;
11371137
return;
11381138
}
11391139
final typeRegistration = factoryToRemove.registeredIn;
@@ -1361,7 +1361,7 @@ class _GetItImplementation implements GetIt {
13611361
} catch (e) {
13621362
final failedScope = _scopes.last;
13631363

1364-
/// prevend any new registrations in this scope
1364+
/// prevent any new registrations in this scope
13651365
failedScope.isFinal = true;
13661366
failedScope.reset(dispose: true);
13671367
_scopes.removeLast();
@@ -1416,7 +1416,7 @@ class _GetItImplementation implements GetIt {
14161416
} catch (e) {
14171417
final failedScope = _scopes.last;
14181418

1419-
/// prevend any new registrations in this scope
1419+
/// prevent any new registrations in this scope
14201420
failedScope.isFinal = true;
14211421
await failedScope.reset(dispose: true);
14221422
_scopes.removeLast();

0 commit comments

Comments
 (0)