cellular-automata/lib/service/engine_service.dart

15 lines
368 B
Dart

import 'package:rules_of_living/src/Engine.dart';
class EngineService {
Engine _uncachedEngineAccess;
Engine get engine => _uncachedEngineAccess ?? _setCachedAndReturn(Engine());
void set engine(Engine newEngine) {
_uncachedEngineAccess = newEngine;
}
Engine _setCachedAndReturn(Engine newEngine) {
engine = newEngine;
return newEngine;
}
}