refactor: centralize data connect error handling and resolve build issues across applications

This commit addresses several critical issues across the mobile monorepo:

1. Centralized Error Handling: Integrated DataErrorHandler mixin into all repository implementations, ensuring consistent mapping of Data Connect exceptions to domain AppExceptions.
2. Build Stabilization: Fixed numerous type mismatches, parameter signature errors in widgets (e.g., google_places_flutter itemBuilder), and naming conflicts (StaffSession, FirebaseAuth).
3. Code Quality: Applied 'dart fix' across all modified packages and manually cleared debug print statements and UI clutter.
4. Mono-repo alignment: Standardized Data Connect usage and aliasing ('dc.') for better maintainability.

Signed-off-by: Suriya <suriya@tenext.in>
This commit is contained in:
2026-02-06 13:28:57 +05:30
parent e0636e46a3
commit 5e7bf0d5c0
150 changed files with 1506 additions and 2547 deletions

View File

@@ -57,6 +57,12 @@ class UiColors {
/// Focus ring color (#0A39DF)
static const Color ring = Color(0xFF0A39DF);
/// Success green color (#10B981)
static const Color success = Color(0xFF10B981);
/// Error red color (#F04444)
static const Color error = destructive;
// ---------------------------------------------------------------------------
// 2. Semantic Mappings
// ---------------------------------------------------------------------------

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:krow_core_localization/krow_core_localization.dart';
import 'package:core_localization/core_localization.dart';
import '../ui_colors.dart';
import '../ui_typography.dart';
@@ -28,14 +28,15 @@ class UiErrorSnackbar {
String? errorCode,
Duration duration = const Duration(seconds: 4),
}) {
final texts = Texts.of(context);
final message = _getMessageFromKey(texts, messageKey);
// 1. Added explicit type 'Translations' to satisfy the lint
final Translations texts = Translations.of(context);
final String message = _getMessageFromKey(texts, messageKey);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Row(
children: [
Icon(Icons.error_outline, color: UiColors.white),
const Icon(Icons.error_outline, color: UiColors.white),
const SizedBox(width: 12),
Expanded(
child: Column(
@@ -51,7 +52,8 @@ class UiErrorSnackbar {
Text(
'Error Code: $errorCode',
style: UiTypography.footnote2r.copyWith(
color: UiColors.white.withOpacity(0.7),
// 3. Fixed deprecated member use
color: UiColors.white.withValues(alpha: 0.7),
),
),
],
@@ -75,7 +77,7 @@ class UiErrorSnackbar {
/// - errors.auth.invalid_credentials
/// - errors.hub.has_orders
/// - errors.generic.unknown
static String _getMessageFromKey(Texts texts, String key) {
static String _getMessageFromKey(Translations texts, String key) {
// Parse key like "errors.auth.invalid_credentials"
final parts = key.split('.');
if (parts.length < 2) return texts.errors.generic.unknown;
@@ -102,7 +104,7 @@ class UiErrorSnackbar {
}
}
static String _getAuthError(Texts texts, String key) {
static String _getAuthError(Translations texts, String key) {
switch (key) {
case 'invalid_credentials':
return texts.errors.auth.invalid_credentials;
@@ -131,7 +133,7 @@ class UiErrorSnackbar {
}
}
static String _getHubError(Texts texts, String key) {
static String _getHubError(Translations texts, String key) {
switch (key) {
case 'has_orders':
return texts.errors.hub.has_orders;
@@ -144,7 +146,7 @@ class UiErrorSnackbar {
}
}
static String _getOrderError(Texts texts, String key) {
static String _getOrderError(Translations texts, String key) {
switch (key) {
case 'missing_hub':
return texts.errors.order.missing_hub;
@@ -161,7 +163,7 @@ class UiErrorSnackbar {
}
}
static String _getProfileError(Texts texts, String key) {
static String _getProfileError(Translations texts, String key) {
switch (key) {
case 'staff_not_found':
return texts.errors.profile.staff_not_found;
@@ -174,7 +176,7 @@ class UiErrorSnackbar {
}
}
static String _getShiftError(Texts texts, String key) {
static String _getShiftError(Translations texts, String key) {
switch (key) {
case 'no_open_roles':
return texts.errors.shift.no_open_roles;
@@ -187,7 +189,7 @@ class UiErrorSnackbar {
}
}
static String _getGenericError(Texts texts, String key) {
static String _getGenericError(Translations texts, String key) {
switch (key) {
case 'unknown':
return texts.errors.generic.unknown;

View File

@@ -1,6 +1,7 @@
name: design_system
description: "A new Flutter package project."
version: 0.0.1
publish_to: none
homepage:
resolution: workspace
@@ -14,6 +15,8 @@ dependencies:
google_fonts: ^7.0.2
lucide_icons: ^0.257.0
font_awesome_flutter: ^10.7.0
core_localization:
path: ../core_localization
dev_dependencies:
flutter_test:

View File

@@ -1,12 +0,0 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:design_system/design_system.dart';
void main() {
test('adds one to input values', () {
final calculator = Calculator();
expect(calculator.addOne(2), 3);
expect(calculator.addOne(-7), -6);
expect(calculator.addOne(0), 1);
});
}