Skip to content

Commit

Permalink
feat: add get_it
Browse files Browse the repository at this point in the history
  • Loading branch information
MahanRahmati committed Jul 20, 2023
1 parent 51871aa commit fd0f84a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 1.9.0

- Bump dependencies
- Add get_it

## 1.8.0

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ This boilerplate includes several common dependencies that you may find useful w
| [json_serializable](https://pub.dev/packages/json_serializable/) | Code generation for converting to and from JSON |
| [flutter_native_splash](https://pub.dev/packages/flutter_native_splash/) | Native splash screen |
| [arna_web_service](https://pub.dev/packages/arna_web_service) | Web service |
| [get_it](https://pub.dev/packages/get_it) | Dependency injection |

You can add or remove dependencies as needed for your specific use case.

Expand Down
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:arna_logger/arna_logger.dart';
import 'package:flutter/material.dart';

import '/src/app.dart';
import '/src/services/get_it_service.dart';
import '/src/services/hive_storage.dart';
import '/src/services/native_splash.dart';
import '/src/services/orientations.dart';
Expand All @@ -15,6 +16,7 @@ Future<void> main() async {
await NativeSplash.instance.init(widgetsBinding);
Orientations.setPreferredOrientations();
await HiveStorage.instance.init();
setupDependencies();
runApp(const App());
}, (final Object error, final StackTrace stack) {
arnaLogger(title: 'Run Stack', data: stack);
Expand Down
5 changes: 5 additions & 0 deletions lib/src/services/get_it_service.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'package:get_it/get_it.dart';

final GetIt getIt = GetIt.instance;

void setupDependencies() {}
12 changes: 10 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.2.0"
get_it:
dependency: "direct main"
description:
name: get_it
sha256: "529de303c739fca98cd7ece5fca500d8ff89649f1bb4b4e94fb20954abcd7468"
url: "https://pub.dev"
source: hosted
version: "7.6.0"
glob:
dependency: transitive
description:
Expand All @@ -377,10 +385,10 @@ packages:
dependency: "direct main"
description:
name: go_router
sha256: b33a88c67816312597e5e0f5906c5139a0b9bd9bb137346e872c788da7af8ea0
sha256: "5927202c23bec18ba93f662b5e1f81f2caa2e0cfa472d857d6229f63d59f1730"
url: "https://pub.dev"
source: hosted
version: "9.0.3"
version: "9.1.0"
graphs:
dependency: transitive
description:
Expand Down
5 changes: 4 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
safe_change_notifier: ^0.3.1

# Routing
go_router: ^9.0.3
go_router: ^9.1.0

# Storage
hive: ^2.2.3
Expand Down Expand Up @@ -46,6 +46,9 @@ dependencies:
# Web service
arna_web_service: ^1.8.0

# Dependency Injection
get_it: ^7.6.0

dev_dependencies:
build_runner: ^2.4.6
flutter_lints: ^2.0.2
Expand Down

0 comments on commit fd0f84a

Please sign in to comment.