Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 0b63dea

Browse files
committed
Add documentation
1 parent 0f35095 commit 0b63dea

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

packages/camera/camera/example/ios/RunnerTests/CameraMethodChannelTests.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@ @interface MockFLTThreadSafeFlutterResult : FLTThreadSafeFlutterResult
1717
@end
1818

1919
@implementation MockFLTThreadSafeFlutterResult
20+
/**
21+
Initialize with a notification center.
22+
*/
2023
- (id)initWithNotificationCenter:(NSNotificationCenter *)notificationCenter {
2124
self = [super init];
2225
_notificationCenter = notificationCenter;
2326
return self;
2427
}
28+
29+
/**
30+
Called when result is successful. Sends "successWithData" to the notification center.
31+
*/
2532
- (void)successWithData:(id)data {
2633
_receivedResult = data;
2734
[self->_notificationCenter postNotificationName:@"successWithData" object:nil];

packages/camera/camera/ios/Classes/FLTThreadSafeFlutterResult.h

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,43 @@
44

55
#import <Flutter/Flutter.h>
66

7+
/**
8+
Wrapper object that always delivers the result on the main thread.
9+
*/
710
@interface FLTThreadSafeFlutterResult : NSObject
11+
12+
/**
13+
Initialize with a FlutterResult object.
14+
@param result The FlutterResult object that the result will be given to.
15+
*/
816
- (id _Nonnull)initWithResult:(FlutterResult _Nonnull)result;
17+
18+
/**
19+
Send a successful result without any data.
20+
*/
921
- (void)success;
22+
23+
/**
24+
Send a successful result with data.
25+
@param data Result data that is send to the Flutter Dart side.
26+
*/
1027
- (void)successWithData:(id _Nonnull)data;
28+
29+
/**
30+
Send an error as result
31+
@param error Error that will be send as FlutterError.
32+
*/
1133
- (void)error:(NSError* _Nonnull)error;
12-
- (void)notImplemented;
34+
35+
/**
36+
Send a FlutterError as result.
37+
*/
1338
- (void)errorWithCode:(NSString* _Nonnull)code
1439
message:(NSString* _Nullable)message
1540
details:(id _Nullable)details;
41+
42+
/**
43+
Send FlutterMethodNotImplemented as result.
44+
*/
45+
- (void)notImplemented;
1646
@end

0 commit comments

Comments
 (0)