Flutter Engine
The Flutter Engine
Instance Methods | Class Methods | Properties | List of all members
FlutterRestorationPlugin Class Reference

#import <FlutterRestorationPlugin.h>

Inheritance diagram for FlutterRestorationPlugin:

Instance Methods

(instancetype) - NS_UNAVAILABLE
 
(instancetype) - initWithChannel:restorationEnabled:
 
(void) - markRestorationComplete
 
(void) - reset
 
(void) - handleMethodCall:result: [implementation]
 
(void) - setRestorationData: [implementation]
 
(NSDictionary *) - dataForFramework [implementation]
 

Class Methods

(instancetype) + NS_UNAVAILABLE
 

Properties

NSData * restorationData
 
FlutterResult pendingRequest [implementation]
 

Detailed Description

Definition at line 12 of file FlutterRestorationPlugin.h.

Method Documentation

◆ dataForFramework

- (NSDictionary *) dataForFramework
implementation

Definition at line 20 of file FlutterRestorationPlugin.mm.

80 {
82 return @{@"enabled" : @NO};
83 }
84 if (self.restorationData == nil) {
85 return @{@"enabled" : @YES};
86 }
87 return @{
88 @"enabled" : @YES,
89 @"data" : [FlutterStandardTypedData typedDataWithBytes:self.restorationData]
90 };
91}
BOOL _restorationEnabled
instancetype typedDataWithBytes:(NSData *data)

◆ handleMethodCall:result:

- (void) handleMethodCall: (FlutterMethodCall*)  call
result: (FlutterResult result 
implementation

Definition at line 20 of file FlutterRestorationPlugin.mm.

38 if ([[call method] isEqualToString:@"put"]) {
39 NSAssert(self.pendingRequest == nil, @"Cannot put data while a get request is pending.");
41 self.restorationData = [data data];
42 result(nil);
43 } else if ([[call method] isEqualToString:@"get"]) {
44 if (!_restorationEnabled || !_waitForData) {
46 return;
47 }
48 NSAssert(self.pendingRequest == nil, @"There can only be one pending request.");
49 self.pendingRequest = result;
50 } else {
52 }
53}
void(^ FlutterResult)(id _Nullable result)
FLUTTER_DARWIN_EXPORT NSObject const * FlutterMethodNotImplemented
GAsyncResult * result
def call(args)
Definition: dom.py:159
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ initWithChannel:restorationEnabled:

- (instancetype) initWithChannel: (FlutterMethodChannel*)  channel
restorationEnabled: (BOOL NS_DESIGNATED_INITIALIZER 

Definition at line 20 of file FlutterRestorationPlugin.mm.

23 :(FlutterMethodChannel*)channel
24 restorationEnabled:(BOOL)restorationEnabled {
25 FML_DCHECK(channel) << "channel must be set";
26 self = [super init];
27 if (self) {
28 [channel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
29 [self handleMethodCall:call result:result];
30 }];
31 _restorationEnabled = restorationEnabled;
32 _waitForData = restorationEnabled;
33 }
34 return self;
35}
#define FML_DCHECK(condition)
Definition: logging.h:103
void setMethodCallHandler:(FlutterMethodCallHandler _Nullable handler)
int BOOL
Definition: windows_types.h:37

◆ markRestorationComplete

- (void) markRestorationComplete

Definition at line 20 of file FlutterRestorationPlugin.mm.

66 {
67 _waitForData = NO;
68 if (self.pendingRequest != nil) {
69 NSAssert(_restorationEnabled, @"No request can be pending when restoration is disabled.");
70 self.pendingRequest([self dataForFramework]);
71 self.pendingRequest = nil;
72 }
73}

◆ NS_UNAVAILABLE [1/2]

- (instancetype) NS_UNAVAILABLE

◆ NS_UNAVAILABLE [2/2]

+ (instancetype) NS_UNAVAILABLE

◆ reset

- (void) reset

Definition at line 20 of file FlutterRestorationPlugin.mm.

75 {
76 self.pendingRequest = nil;
77 self.restorationData = nil;
78}

◆ setRestorationData:

- (void) setRestorationData: (NSData*)  data
implementation

Definition at line 20 of file FlutterRestorationPlugin.mm.

55 :(NSData*)data {
56 if (data != _restorationData) {
57 _restorationData = [data copy];
58 }
59 _waitForData = NO;
60 if (self.pendingRequest != nil) {
61 self.pendingRequest([self dataForFramework]);
62 self.pendingRequest = nil;
63 }
64}

Property Documentation

◆ pendingRequest

- (FlutterResult) pendingRequest
readwritenonatomiccopyimplementation

Definition at line 15 of file FlutterRestorationPlugin.mm.

◆ restorationData

- (NSData*) restorationData
readwritenonatomiccopy

Definition at line 18 of file FlutterRestorationPlugin.h.


The documentation for this class was generated from the following files: