first commit
This commit is contained in:
25
lib/app/bindings/auth_binding.dart
Normal file
25
lib/app/bindings/auth_binding.dart
Normal file
@ -0,0 +1,25 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../data/providers/auth_provider.dart';
|
||||
import '../modules/auth/controllers/auth_controller.dart';
|
||||
|
||||
class AuthBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
debugPrint('Initializing AuthBinding dependencies');
|
||||
|
||||
// Pastikan AuthProvider dibuat sekali dan bersifat permanen
|
||||
if (!Get.isRegistered<AuthProvider>()) {
|
||||
debugPrint('Registering AuthProvider in AuthBinding');
|
||||
Get.put<AuthProvider>(AuthProvider(), permanent: true);
|
||||
} else {
|
||||
debugPrint('AuthProvider already registered');
|
||||
}
|
||||
|
||||
// Buat AuthController
|
||||
debugPrint('Creating AuthController');
|
||||
Get.lazyPut<AuthController>(() => AuthController());
|
||||
|
||||
debugPrint('AuthBinding dependencies initialized');
|
||||
}
|
||||
}
|
1
lib/app/bindings/home_binding.dart
Normal file
1
lib/app/bindings/home_binding.dart
Normal file
@ -0,0 +1 @@
|
||||
|
30
lib/app/bindings/petugas_bumdes_binding.dart
Normal file
30
lib/app/bindings/petugas_bumdes_binding.dart
Normal file
@ -0,0 +1,30 @@
|
||||
import 'package:get/get.dart';
|
||||
import '../data/providers/auth_provider.dart';
|
||||
import '../modules/petugas_bumdes/controllers/petugas_bumdes_dashboard_controller.dart';
|
||||
|
||||
class PetugasBumdesBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
// Pastikan AuthProvider teregistrasi
|
||||
if (!Get.isRegistered<AuthProvider>()) {
|
||||
Get.put(AuthProvider());
|
||||
}
|
||||
|
||||
// Hapus terlebih dahulu untuk memastikan clean state
|
||||
try {
|
||||
if (Get.isRegistered<PetugasBumdesDashboardController>()) {
|
||||
Get.delete<PetugasBumdesDashboardController>(force: true);
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error removing controller: $e');
|
||||
}
|
||||
|
||||
// Gunakan put untuk memastikan controller selalu tersedia dan permanent
|
||||
Get.put<PetugasBumdesDashboardController>(
|
||||
PetugasBumdesDashboardController(),
|
||||
permanent: true,
|
||||
);
|
||||
|
||||
print('✅ PetugasBumdesDashboardController registered successfully');
|
||||
}
|
||||
}
|
13
lib/app/bindings/petugas_mitra_binding.dart
Normal file
13
lib/app/bindings/petugas_mitra_binding.dart
Normal file
@ -0,0 +1,13 @@
|
||||
import 'package:get/get.dart';
|
||||
import '../data/providers/auth_provider.dart';
|
||||
import '../modules/petugas_mitra/controllers/petugas_mitra_dashboard_controller.dart';
|
||||
|
||||
class PetugasMitraBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut<AuthProvider>(() => AuthProvider());
|
||||
Get.lazyPut<PetugasMitraDashboardController>(
|
||||
() => PetugasMitraDashboardController(),
|
||||
);
|
||||
}
|
||||
}
|
1
lib/app/bindings/profile_binding.dart
Normal file
1
lib/app/bindings/profile_binding.dart
Normal file
@ -0,0 +1 @@
|
||||
|
25
lib/app/bindings/splash_binding.dart
Normal file
25
lib/app/bindings/splash_binding.dart
Normal file
@ -0,0 +1,25 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../data/providers/auth_provider.dart';
|
||||
import '../modules/splash/controllers/splash_controller.dart';
|
||||
|
||||
class SplashBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
debugPrint('Initializing SplashBinding dependencies');
|
||||
|
||||
// Pastikan AuthProvider dibuat sekali dan bersifat permanen
|
||||
if (!Get.isRegistered<AuthProvider>()) {
|
||||
debugPrint('Registering AuthProvider in SplashBinding');
|
||||
Get.put<AuthProvider>(AuthProvider(), permanent: true);
|
||||
} else {
|
||||
debugPrint('AuthProvider already registered');
|
||||
}
|
||||
|
||||
// Buat SplashController
|
||||
debugPrint('Creating SplashController');
|
||||
Get.put<SplashController>(SplashController());
|
||||
|
||||
debugPrint('SplashBinding dependencies initialized');
|
||||
}
|
||||
}
|
11
lib/app/bindings/warga_binding.dart
Normal file
11
lib/app/bindings/warga_binding.dart
Normal file
@ -0,0 +1,11 @@
|
||||
import 'package:get/get.dart';
|
||||
import '../data/providers/auth_provider.dart';
|
||||
import '../modules/warga/controllers/warga_dashboard_controller.dart';
|
||||
|
||||
class WargaBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut<AuthProvider>(() => AuthProvider());
|
||||
Get.lazyPut<WargaDashboardController>(() => WargaDashboardController());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user