Skip to content

Commit

Permalink
Created example with scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoRB committed Jun 16, 2024
1 parent ceb2240 commit 524cc39
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 3 deletions.
42 changes: 42 additions & 0 deletions examples/dartness_flutter_melos/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
// Use IntelliSense para saber los atributos posibles.
// Mantenga el puntero para ver las descripciones de los existentes atributos.
// Para más información, visite: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "dartness_flutter_melos",
"request": "launch",
"type": "dart"
},
{
"name": "my_app",
"cwd": "apps\\my_app",
"request": "launch",
"program": "lib/main.dart",
"flutterMode": "debug",
"type": "dart"
},
{
"name": "my_app (profile mode)",
"cwd": "apps\\my_app",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
},
{
"name": "my_app (release mode)",
"cwd": "apps\\my_app",
"request": "launch",
"type": "dart",
"flutterMode": "release"
},
{
"name": "my_server",
"cwd": "servers\\my_server",
"request": "launch",
"program": "bin\\my_server.dart",
"type": "dart"
}
]
}
4 changes: 4 additions & 0 deletions examples/dartness_simple/lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:dartness_server/dartness.dart';
import 'package:dartness_server/modules.dart';
import 'package:dartness_server/server.dart';
import 'package:dio/dio.dart';
import 'package:example/src/schedulers/example_scheduler.dart';

import 'controllers/city_controller.dart';
import 'controllers/todos_controller.dart';
Expand All @@ -28,6 +29,9 @@ Dio createDio() => Dio();
classType: Dio,
useFactory: createDio,
),
ProviderMetadata(
classType: ExampleScheduler,
)
],
imports: [
userModule,
Expand Down
2 changes: 2 additions & 0 deletions examples/dartness_simple/lib/src/app.g.dart

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

11 changes: 11 additions & 0 deletions examples/dartness_simple/lib/src/schedulers/example_scheduler.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:dartness_server/schedule.dart';

part 'example_scheduler.g.dart';

@Scheduler()
class ExampleScheduler {
@Scheduled(cron: "* * * * *")
void example() {
print("${DateTime.now()} Hello world");
}
}

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

8 changes: 5 additions & 3 deletions examples/dartness_simple/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ environment:
sdk: ">=3.0.0 <4.0.0"

dependencies:
dartness_server: ^0.6.0
dartness_server:
path: ../../packages/dartness_server
dio: ^5.3.3

dev_dependencies:
build_runner: ^2.4.6
dartness_generator: ^0.6.0
lints: ^3.0.0
dartness_generator:
path: ../../packages/dartness_generator
lints: ^4.0.0
test: ^1.24.9

0 comments on commit 524cc39

Please sign in to comment.