eServiceApps — Mobile Super App v1.0.0

Feature-modular Flutter super app combining social networking, ride-sharing, travel planning, and delivery services into a single mobile platform. Built with Dart/Flutter using clean architecture, Riverpod state management, GoRouter navigation, and Firebase backend.

Stack: Dart 3 + Flutter 3.x | State: Riverpod | Navigation: GoRouter | Backend: Firebase | License: MIT

Feature Modules

Social — User profiles, posts, feeds, messaging.
Ride — Ride-sharing with map integration and tracking.
Travel — Destinations, bookings, itineraries.
Delivery — Package/food delivery with order tracking.
Each module follows clean architecture: features/[name]/models, services, views, widgets.

🏗 Architecture

Feature-modular Flutter with Riverpod + GoRouter + Firebase.

Project Structure

eServiceApps/
  lib/
    app/              App widget, theme, router
    core/             Shared utilities, constants, extensions
    features/
      social/         models/ services/ views/ widgets/
      ride/           models/ services/ views/ widgets/
      travel/         models/ services/ views/ widgets/
      delivery/       models/ services/ views/ widgets/
      auth/           models/ services/ views/ widgets/
    shared/           Shared widgets, providers, mixins
  test/               Unit and widget tests
  integration_test/   Integration tests
  firebase/           Security rules, indexes
Clean Architecture

Each feature module is self-contained with models/ (data classes), services/ (business logic + API), views/ (screens), and widgets/ (reusable UI). Cross-feature communication uses Riverpod providers.

Core Dependencies

flutter_riverpod^2.4.0State management
go_router^13.0.0Declarative routing
firebase_core^2.24.0Firebase initialization
cloud_firestore^4.13.0NoSQL database
firebase_auth^4.15.0Authentication
firebase_storage^11.5.0File storage
google_maps_flutter^2.5.0Maps integration
freezed^2.4.0Immutable data classes

👥 Social Module

Social networking: profiles, posts, feeds, messaging.

SocialService SocialService(FirebaseFirestore db, FirebaseAuth auth)

Core social networking service managing posts, feeds, user profiles, and real-time messaging.

Parameters
dbFirebaseFirestoreFirestore instance.
authFirebaseAuthAuth instance.
Example
final socialService = ref.watch(socialServiceProvider);

PostModel

idStringUnique post ID
authorIdStringAuthor user ID
contentStringPost text content
mediaUrlsList<String>Attached media URLs
likesintLike count
commentsintComment count
createdAtDateTimeCreation timestamp
Future<void> createPost(PostModel post)

Create a new post. Uploads media to Firebase Storage, stores metadata in Firestore, and notifies followers.

Example
await socialService.createPost(PostModel(
  content: 'Hello world!',
  mediaUrls: [uploadedUrl],
));
Stream<List<PostModel>> getFeed(String userId, {int limit = 20})

Real-time feed stream using Firestore snapshots. Merges posts from followed users, sorted by timestamp.

Future<void> sendMessage(String chatId, MessageModel msg)

Send a real-time message in a chat thread. Updates Firestore and triggers push notification.

🚗 Ride Module

Ride-sharing with map integration, booking, and live tracking.

RideService RideService(FirebaseFirestore db, GoogleMapsApi maps)

Ride booking, driver matching, real-time tracking, and fare calculation.

Parameters
dbFirebaseFirestoreFirestore instance.
mapsGoogleMapsApiMaps API client.

BookingModel

idStringBooking ID
riderIdStringRider user ID
driverIdString?Matched driver (null until matched)
pickupLatLngPickup coordinates
destinationLatLngDestination coordinates
statusRideStatusrequested, matched, in_progress, completed, cancelled
faredoubleCalculated fare
Future<BookingModel> requestRide(LatLng pickup, LatLng dest)

Request a ride. Calculates route, estimates fare, and enters driver matching queue.

Example
final booking = await rideService.requestRide(
  LatLng(37.78, -122.41), LatLng(37.33, -121.89)
);
Stream<DriverLocation> trackDriver(String bookingId)

Real-time driver location stream via Firestore. Updates every 3 seconds during active rides.

MapView

Interactive Google Maps widget showing pickup/destination markers, route polyline, and live driver position. Uses google_maps_flutter with custom markers and info windows.

✈ Travel Module

Travel planning with destinations, bookings, and itineraries.

TravelService TravelService(FirebaseFirestore db)

Destination discovery, hotel/flight bookings, and itinerary management.

DestinationModel

idStringDestination ID
nameStringDestination name
countryStringCountry
imageUrlStringCover image
ratingdoubleAverage rating (0-5)
priceRangePriceRangebudget, moderate, luxury
Future<List<DestinationModel>> searchDestinations(String query, {DestinationFilter? filter})

Search destinations with optional filters: country, priceRange, rating, activities.

Future<Itinerary> createItinerary(String destId, DateRange dates)

Generate a day-by-day itinerary for a destination and date range.

📦 Delivery Module

Package and food delivery with order tracking.

DeliveryService DeliveryService(FirebaseFirestore db)

Order placement, real-time tracking, delivery status updates.

OrderModel

idStringOrder ID
userIdStringCustomer user ID
itemsList<OrderItem>Ordered items
statusOrderStatusplaced, preparing, picked_up, in_transit, delivered
deliveryAddressAddressDelivery address
estimatedArrivalDateTimeETA
trackingUrlString?Live tracking URL
Future<OrderModel> placeOrder(List<OrderItem> items, Address addr)

Place a delivery order. Validates items, calculates total, assigns courier.

Example
final order = await deliveryService.placeOrder(
  [OrderItem(name:'Pizza',qty:2,price:12.99)],
  Address(street:'123 Main St',city:'SF')
);
Stream<OrderStatus> trackOrder(String orderId)

Real-time order status stream. Emits updates as order progresses through stages.

🔒 Authentication

Firebase Auth with email/password and social login.

AuthService AuthService(FirebaseAuth auth)

Authentication service with email/password, Google, and Apple sign-in. Manages auth state and user sessions.

Parameters
authFirebaseAuthFirebase Auth instance.
Example
final authService = ref.watch(authServiceProvider);
Future<UserCredential> signInWithEmail(String email, String password)

Sign in with email and password. Throws AuthException on failure.

Example
await authService.signInWithEmail('user@example.com', 'pass123');
Future<UserCredential> signInWithGoogle()

Sign in with Google OAuth. Opens native Google sign-in flow.

Example
final cred = await authService.signInWithGoogle();
Future<UserCredential> signInWithApple()

Sign in with Apple ID. iOS 13+ required.

Example
final cred = await authService.signInWithApple();
Future<void> signOut()

Sign out the current user and clear local session.

AuthGuard

Route guard that redirects unauthenticated users to the login screen. Integrates with GoRouter's redirect callback.

GoRouter(
  redirect: (context, state) {
    final loggedIn = ref.read(authStateProvider).valueOrNull != null;
    if (!loggedIn) return '/login';
    return null;
  },
  routes: [...]
);

🔌 Routing

GoRouter declarative navigation with deep linking and guards.

GoRouter createAppRouter(Ref ref)

Create the app router with all feature routes, auth guards, and deep link support.

Example
final router = createAppRouter(ref);

app_router.dart Configuration

final appRouter = GoRouter(
  initialLocation: '/social/feed',
  routes: [
    GoRoute(path: '/social/feed', builder: (_, __) => FeedView()),
    GoRoute(path: '/social/profile/:id', builder: (_, s) => ProfileView(id: s.pathParameters['id']!)),
    GoRoute(path: '/ride', builder: (_, __) => RideHomeView()),
    GoRoute(path: '/ride/booking/:id', builder: (_, s) => BookingView(id: s.pathParameters['id']!)),
    GoRoute(path: '/travel', builder: (_, __) => TravelHomeView()),
    GoRoute(path: '/delivery', builder: (_, __) => DeliveryHomeView()),
    GoRoute(path: '/delivery/track/:id', builder: (_, s) => TrackingView(id: s.pathParameters['id']!)),
    GoRoute(path: '/login', builder: (_, __) => LoginView()),
  ],
);
Deep Linking

All routes support deep linking via go_router. URLs like eserviceapps://ride/booking/abc123 open directly to the booking screen on mobile.

🎨 Theming

Material 3 with custom theme, light/dark modes, and brand colors.

AppTheme

class AppTheme {
  static ThemeData light() => ThemeData(
    useMaterial3: true,
    colorSchemeSeed: const Color(0xFF3B82F6),
    brightness: Brightness.light,
    fontFamily: 'Inter',
  );
  static ThemeData dark() => ThemeData(
    useMaterial3: true,
    colorSchemeSeed: const Color(0xFF3B82F6),
    brightness: Brightness.dark,
    fontFamily: 'Inter',
  );
}

Brand Colors

Primary#3B82F6Blue - primary actions
Secondary#10B981Green - success, ride
Tertiary#8B5CF6Purple - travel
Error#EF4444Red - errors, alerts
Surface#FFFFFF / #1E1E1ELight/dark backgrounds
ThemeProvider ThemeProvider()

Riverpod StateNotifier managing theme mode (light, dark, system). Persists preference to SharedPreferences.

Example
final themeMode = ref.watch(themeProvider);
ref.read(themeProvider.notifier).toggle();

⚙ State Management

Riverpod providers for feature isolation and reactive state.

Riverpod Provider Types

Provider — Read-only computed values.
StateProvider — Simple mutable state.
StateNotifierProvider — Complex state with business logic.
FutureProvider — Async one-shot data.
StreamProvider — Real-time reactive data.

Best Practices for Feature Isolation

// Each feature defines its own providers
// features/social/providers.dart
final socialServiceProvider = Provider<SocialService>((ref) {
  final db = ref.watch(firestoreProvider);
  final auth = ref.watch(firebaseAuthProvider);
  return SocialService(db, auth);
});

final feedProvider = StreamProvider.family<List<PostModel>, String>((ref, userId) {
  return ref.watch(socialServiceProvider).getFeed(userId);
});

// In views - use AsyncValue for loading/error/data states
ref.watch(feedProvider(userId)).when(
  data: (posts) => PostList(posts: posts),
  loading: () => const CircularProgressIndicator(),
  error: (e, st) => ErrorWidget(e),
);

🔥 Firebase Integration

Firestore, Storage, Analytics, Crashlytics configuration.

Firebase Services

FirestoreNoSQL document databaseUser profiles, posts, bookings, orders
Firebase AuthAuthenticationEmail/password, Google, Apple sign-in
Firebase StorageFile/media storageProfile images, post media, documents
AnalyticsEvent trackingScreen views, user actions, conversions
CrashlyticsCrash reportingReal-time crash reports with stack traces

Security Rules

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /users/{userId} {
      allow read: if request.auth != null;
      allow write: if request.auth.uid == userId;
    }
    match /posts/{postId} {
      allow read: if request.auth != null;
      allow create: if request.auth != null
        && request.resource.data.authorId == request.auth.uid;
      allow delete: if resource.data.authorId == request.auth.uid;
    }
    match /bookings/{bookingId} {
      allow read, write: if request.auth != null
        && (resource.data.riderId == request.auth.uid
        || resource.data.driverId == request.auth.uid);
    }
    match /orders/{orderId} {
      allow read, write: if request.auth != null
        && resource.data.userId == request.auth.uid;
    }
  }
}

Data Model

Firestore Collections

usersUser profiles, preferences, followersDocument per user
postsSocial posts with media refsSubcollections: comments, likes
chatsChat threadsSubcollections: messages
bookingsRide bookingsStatus updates via Firestore triggers
destinationsTravel destinationsCached with offline persistence
ordersDelivery ordersReal-time status via snapshots