11 [_entrypoint release];
12 [_libraryURI release];
13 [_initialRoute release];
14 [_entrypointArgs release];
21 @property(nonatomic, copy) NSString* name;
22 @property(nonatomic, retain) NSMutableArray<NSValue*>* engines;
27 int _enginesCreatedCount;
34 _engines = [[NSMutableArray<NSValue*> alloc] init];
35 _project = [project retain];
47 - (
FlutterEngine*)makeEngineWithEntrypoint:(nullable NSString*)entrypoint
48 libraryURI:(nullable NSString*)libraryURI {
52 - (
FlutterEngine*)makeEngineWithEntrypoint:(nullable NSString*)entrypoint
53 libraryURI:(nullable NSString*)libraryURI
54 initialRoute:(nullable NSString*)initialRoute {
69 if (
self.engines.count <= 0) {
70 engine = [
self makeEngine];
82 [_engines addObject:[NSValue valueWithPointer:engine]];
84 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
85 [center addObserver:self
86 selector:@selector(onEngineWillBeDealloced:)
87 name:kFlutterEngineWillDealloc
94 NSString* engineName = [NSString stringWithFormat:@"%@.%d", self.name, ++_enginesCreatedCount];
96 return [result autorelease];
99 - (void)onEngineWillBeDealloced:(NSNotification*)notification {
100 [_engines removeObject:[NSValue valueWithPointer:notification.object]];