CoolFlutterResult.m 553 B

123456789101112131415161718192021222324252627282930313233
  1. //
  2. // Created by Caijinglong on 2019-06-12.
  3. //
  4. #import "CoolFlutterResult.h"
  5. @implementation CoolFlutterResult {
  6. }
  7. - (instancetype)initWithResult:(FlutterResult)result {
  8. self = [super init];
  9. if (self) {
  10. self.result = result;
  11. self.isReply = NO;
  12. }
  13. return self;
  14. }
  15. + (instancetype)resultWithResult:(FlutterResult)result {
  16. return [[self alloc] initWithResult:result];
  17. }
  18. - (void)replyResult:(id _Nullable)result {
  19. if (self.isReply) {
  20. return;
  21. }
  22. self.isReply = YES;
  23. self.result(result);
  24. }
  25. @end