checkFlagConflicts static method

void checkFlagConflicts({
  1. bool simulation = kSimulationMode,
  2. bool realBackend = kRealBackendMode,
})

Whether the compile-time flag set is coherent.

FR-012: a build that sets both SIMULATION=true and REAL_BACKEND=true is ambiguous — simulation mode must either take precedence or produce a conflict error, never silently fall through to real network calls. This gate produces the explicit conflict error, and every generated simulation binding and boot entry point (SimulationBoot and the generated registerSimulationBindings) runs it before any binding is registered.

Implementation

static void checkFlagConflicts({
  bool simulation = kSimulationMode,
  bool realBackend = kRealBackendMode,
}) {
  if (simulation && realBackend) {
    throw SimulationFlagConflict(
      'Build-time flag conflict: --dart-define=SIMULATION=true and '
      '--dart-define=REAL_BACKEND=true were both set. The SIMULATION '
      'flavor boots exclusively on certified mocks and must not be '
      'combined with a real-backend flavor. Rebuild with a single '
      'flavor define.',
    );
  }
}