Skip to content

Commit

Permalink
fix(pubspecs): changed dart maximium version and runned dart fix all …
Browse files Browse the repository at this point in the history
…in all files.
  • Loading branch information
gbtb16 committed Jan 15, 2024
1 parent fe110bc commit 855fd51
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 37 deletions.
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.1.0
homepage: https://github.com/gbtb16/kiwi

environment:
sdk: '>=2.14.0 <3.0.0'
sdk: '>=2.14.0 <4.0.0'

dependencies:
kiwi: ^4.0.3
Expand Down
9 changes: 3 additions & 6 deletions flutter_example/lib/screen/main_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class MainScreen extends StatelessWidget {
MaterialButton(
color: Theme.of(context).primaryColor,
onPressed: () async {
await Navigator.of(context).push(
MaterialPageRoute(builder: (context) => ResolveScreen()));
await Navigator.of(context).push(MaterialPageRoute(builder: (context) => ResolveScreen()));
KiwiContainer().clear();
},
child: Text(
Expand All @@ -33,8 +32,7 @@ class MainScreen extends StatelessWidget {
MaterialButton(
color: Theme.of(context).primaryColor,
onPressed: () async {
await Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => ErrorScreen()));
await Navigator.of(context).push(MaterialPageRoute(builder: (context) => ErrorScreen()));
KiwiContainer().clear();
},
child: Text(
Expand All @@ -47,8 +45,7 @@ class MainScreen extends StatelessWidget {
MaterialButton(
color: Theme.of(context).primaryColor,
onPressed: () async {
await Navigator.of(context).push(
MaterialPageRoute(builder: (context) => ScopedScreen()));
await Navigator.of(context).push(MaterialPageRoute(builder: (context) => ScopedScreen()));
KiwiContainer().clear();
},
child: Text(
Expand Down
2 changes: 1 addition & 1 deletion flutter_example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A Flutter example for kiwi
version: 1.0.0+1

environment:
sdk: ">=2.14.0 <3.0.0"
sdk: ">=2.14.0 <4.0.0"

dependencies:
flutter:
Expand Down
2 changes: 1 addition & 1 deletion kiwi/lib/kiwi.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
library kiwi;

export 'src/kiwi_container.dart';
export 'src/annotations.dart';
export 'src/kiwi_container.dart';
export 'src/model/exception/kiwi_error.dart';
export 'src/model/exception/not_registered_error.dart';
15 changes: 5 additions & 10 deletions kiwi/lib/src/kiwi_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ typedef T Factory<T>(KiwiContainer container);
/// A simple service container.
class KiwiContainer {
/// Creates a scoped container.
KiwiContainer.scoped()
: _namedProviders = Map<String?, Map<Type, _Provider<Object>>>();
KiwiContainer.scoped() : _namedProviders = Map<String?, Map<Type, _Provider<Object>>>();

static final KiwiContainer _instance = KiwiContainer.scoped();

Expand Down Expand Up @@ -141,14 +140,10 @@ class KiwiContainer {

void _setProvider<T>(String? name, _Provider<T> provider) {
final nameProviders = _namedProviders;
if (!silent &&
(nameProviders.containsKey(name) &&
nameProviders[name]!.containsKey(T))) {
throw KiwiError(
'The type `$T` was already registered${name == null ? '' : ' for the name `$name`'}');
if (!silent && (nameProviders.containsKey(name) && nameProviders[name]!.containsKey(T))) {
throw KiwiError('The type `$T` was already registered${name == null ? '' : ' for the name `$name`'}');
}
_namedProviders.putIfAbsent(name, () => Map<Type, _Provider<Object>>())[T] =
provider as _Provider<Object>;
_namedProviders.putIfAbsent(name, () => Map<Type, _Provider<Object>>())[T] = provider as _Provider<Object>;
}
}

Expand Down Expand Up @@ -183,4 +178,4 @@ class _Provider<T> {

return null;
}
}
}
2 changes: 1 addition & 1 deletion kiwi/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 4.1.0
homepage: https://github.com/gbtb16/kiwi/tree/master/kiwi

environment:
sdk: ">=2.14.0 <3.0.0"
sdk: ">=2.14.0 <4.0.0"

dependencies:
meta: ^1.8.0
Expand Down
18 changes: 5 additions & 13 deletions kiwi_generator/example/kiwi_generator_example.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion kiwi_generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 4.1.0
homepage: https://github.com/gbtb16/kiwi/tree/master/kiwi_generator

environment:
sdk: '>=2.14.0 <3.0.0'
sdk: '>=2.14.0 <4.0.0'

dependencies:
analyzer: ^5.4.0
Expand Down
3 changes: 1 addition & 2 deletions kiwi_generator/test/utils/analysis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import 'package:source_gen/source_gen.dart';
Future<LibraryReader> resolveCompilationUnit(String sourceFile) async {
var files = [File(sourceFile)];

var fileMap = Map<String, String>.fromEntries(files.map(
(f) => MapEntry('a|lib/${p.basename(f.path)}', f.readAsStringSync())));
var fileMap = Map<String, String>.fromEntries(files.map((f) => MapEntry('a|lib/${p.basename(f.path)}', f.readAsStringSync())));

var library = await resolveSources(fileMap, (item) async {
var assetId = AssetId.parse(fileMap.keys.first);
Expand Down
2 changes: 1 addition & 1 deletion tool/actions/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.1.0
homepage: https://github.com/gbtb16/kiwi

environment:
sdk: '>=2.14.0 <3.0.0'
sdk: '>=2.14.0 <4.0.0'

dev_dependencies:
test: ^1.23.1
Expand Down

0 comments on commit 855fd51

Please sign in to comment.