E-Core

Foundation

Core models, entities, and utilities for E-Core

Foundation

The Foundation package provides the core building blocks used throughout E-Core applications.

Overview

e_core_foundation contains:

  • Base Models - Common model interfaces and base classes
  • Entities - Domain entities with identity
  • Value Objects - Immutable value types
  • Utilities - Helper functions and extensions
  • Result Types - Functional error handling

Installation

dependencies:
  e_core_foundation: ^1.0.0

Key Concepts

Base Entity

All domain entities extend from BaseEntity:

class User extends BaseEntity {
  final String name;
  final String email;

  User({
    required super.id,
    required this.name,
    required this.email,
  });
}

Result Type

Handle errors functionally with the Result type:

Future<Result<User, Failure>> getUser(String id) async {
  try {
    final user = await api.fetchUser(id);
    return Success(user);
  } catch (e) {
    return Failure(NetworkFailure(e.toString()));
  }
}

Learn More

On this page