Flutter iOS Embedder
FlutterDartVMServicePublisher Class Reference

#import <FlutterDartVMServicePublisher.h>

Inheritance diagram for FlutterDartVMServicePublisher:

Instance Methods

(instancetype) - initWithEnableVMServicePublication:
 
(instancetype) - NS_UNAVAILABLE
 

Class Methods

(instancetype) + NS_UNAVAILABLE
 

Properties

NSURL * url
 

Detailed Description

Definition at line 10 of file FlutterDartVMServicePublisher.h.

Method Documentation

◆ initWithEnableVMServicePublication:

- (instancetype) initWithEnableVMServicePublication: (BOOL)  NS_DESIGNATED_INITIALIZER

Definition at line 166 of file FlutterDartVMServicePublisher.mm.

166  :(BOOL)enableVMServicePublication {
167  self = [super init];
168  NSAssert(self, @"Super must not return null on init.");
169 
170  _delegate.reset([[DartVMServiceDNSServiceDelegate alloc] init]);
171  _enableVMServicePublication = enableVMServicePublication;
172  _weakFactory = std::make_unique<fml::WeakPtrFactory<FlutterDartVMServicePublisher>>(self);
173 
174  fml::MessageLoop::EnsureInitializedForCurrentThread();
175 
176  _callbackHandle = flutter::DartServiceIsolate::AddServerStatusCallback(
177  [weak = _weakFactory->GetWeakPtr(),
178  runner = fml::MessageLoop::GetCurrent().GetTaskRunner()](const std::string& uri) {
179  if (!uri.empty()) {
180  runner->PostTask([weak, uri]() {
181  // uri comes in as something like 'http://127.0.0.1:XXXXX/' where XXXXX is the port
182  // number.
183  if (weak) {
184  NSURL* url = [[[NSURL alloc]
185  initWithString:[NSString stringWithUTF8String:uri.c_str()]] autorelease];
186  weak.get().url = url;
187  if (weak.get().enableVMServicePublication) {
188  [[weak.get() delegate] publishServiceProtocolPort:url];
189  }
190  }
191  });
192  }
193  });
194 
195  return self;
196 }

References _weakFactory.

◆ NS_UNAVAILABLE [1/2]

+ (instancetype) NS_UNAVAILABLE

◆ NS_UNAVAILABLE [2/2]

- (instancetype) NS_UNAVAILABLE

Property Documentation

◆ url

- (NSURL*) url
readnonatomicretain

Definition at line 17 of file FlutterDartVMServicePublisher.h.


The documentation for this class was generated from the following files:
_weakFactory
std::unique_ptr< fml::WeakPtrFactory< FlutterDartVMServicePublisher > > _weakFactory
Definition: FlutterDartVMServicePublisher.mm:161
DartVMServiceDNSServiceDelegate
Definition: FlutterDartVMServicePublisher.mm:63