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 165 of file FlutterDartVMServicePublisher.mm.

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

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:160
DartVMServiceDNSServiceDelegate
Definition: FlutterDartVMServicePublisher.mm:63