Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Instance Methods | Class Methods | Properties | List of all members
FlutterRestorationPlugin Class Reference

#include <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}
instancetype typedDataWithBytes:(NSData *data)
BOOL _restorationEnabled

◆ 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
if(end==-1)
GAsyncResult * result
call(args)
Definition dom.py:159
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41

◆ 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

◆ 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

Provided by category FlutterRestorationPlugin().

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: