@@ -11,6 +11,12 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
11
11
import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
12
12
import 'package:flutter/services.dart' ;
13
13
14
+ enum AnEnum {
15
+ one,
16
+ two,
17
+ three,
18
+ }
19
+
14
20
class AllTypes {
15
21
AllTypes ({
16
22
this .aBool,
@@ -26,6 +32,7 @@ class AllTypes {
26
32
this .nestedList,
27
33
this .mapWithAnnotations,
28
34
this .mapWithObject,
35
+ this .anEnum,
29
36
});
30
37
31
38
bool ? aBool;
@@ -41,6 +48,7 @@ class AllTypes {
41
48
List <List <bool ?>?>? nestedList;
42
49
Map <String ?, String ?>? mapWithAnnotations;
43
50
Map <String ?, Object ?>? mapWithObject;
51
+ AnEnum ? anEnum;
44
52
45
53
Object encode () {
46
54
final Map <Object ?, Object ?> pigeonMap = < Object ? , Object ? > {};
@@ -57,6 +65,7 @@ class AllTypes {
57
65
pigeonMap['nestedList' ] = nestedList;
58
66
pigeonMap['mapWithAnnotations' ] = mapWithAnnotations;
59
67
pigeonMap['mapWithObject' ] = mapWithObject;
68
+ pigeonMap['anEnum' ] = anEnum? .index;
60
69
return pigeonMap;
61
70
}
62
71
@@ -80,6 +89,9 @@ class AllTypes {
80
89
? .cast <String ?, String ?>(),
81
90
mapWithObject: (pigeonMap['mapWithObject' ] as Map <Object ?, Object ?>? )
82
91
? .cast <String ?, Object ?>(),
92
+ anEnum: pigeonMap['anEnum' ] != null
93
+ ? AnEnum .values[pigeonMap['anEnum' ]! as int ]
94
+ : null ,
83
95
);
84
96
}
85
97
}
@@ -347,7 +359,37 @@ class HostIntegrationCoreApi {
347
359
}
348
360
}
349
361
350
- /// Returns the passed in boolean asynchronously.
362
+ /// Returns passed in double.
363
+ Future <double > echoDouble (double arg_aDouble) async {
364
+ final BasicMessageChannel <Object ?> channel = BasicMessageChannel <Object ?>(
365
+ 'dev.flutter.pigeon.HostIntegrationCoreApi.echoDouble' , codec,
366
+ binaryMessenger: _binaryMessenger);
367
+ final Map <Object ?, Object ?>? replyMap =
368
+ await channel.send (< Object ? > [arg_aDouble]) as Map <Object ?, Object ?>? ;
369
+ if (replyMap == null ) {
370
+ throw PlatformException (
371
+ code: 'channel-error' ,
372
+ message: 'Unable to establish connection on channel.' ,
373
+ );
374
+ } else if (replyMap['error' ] != null ) {
375
+ final Map <Object ?, Object ?> error =
376
+ (replyMap['error' ] as Map <Object ?, Object ?>? )! ;
377
+ throw PlatformException (
378
+ code: (error['code' ] as String ? )! ,
379
+ message: error['message' ] as String ? ,
380
+ details: error['details' ],
381
+ );
382
+ } else if (replyMap['result' ] == null ) {
383
+ throw PlatformException (
384
+ code: 'null-error' ,
385
+ message: 'Host platform returned null value for non-null return value.' ,
386
+ );
387
+ } else {
388
+ return (replyMap['result' ] as double ? )! ;
389
+ }
390
+ }
391
+
392
+ /// Returns the passed in boolean.
351
393
Future <bool > echoBool (bool arg_aBool) async {
352
394
final BasicMessageChannel <Object ?> channel = BasicMessageChannel <Object ?>(
353
395
'dev.flutter.pigeon.HostIntegrationCoreApi.echoBool' , codec,
@@ -377,6 +419,66 @@ class HostIntegrationCoreApi {
377
419
}
378
420
}
379
421
422
+ /// Returns the passed in string.
423
+ Future <String > echoString (String arg_aString) async {
424
+ final BasicMessageChannel <Object ?> channel = BasicMessageChannel <Object ?>(
425
+ 'dev.flutter.pigeon.HostIntegrationCoreApi.echoString' , codec,
426
+ binaryMessenger: _binaryMessenger);
427
+ final Map <Object ?, Object ?>? replyMap =
428
+ await channel.send (< Object ? > [arg_aString]) as Map <Object ?, Object ?>? ;
429
+ if (replyMap == null ) {
430
+ throw PlatformException (
431
+ code: 'channel-error' ,
432
+ message: 'Unable to establish connection on channel.' ,
433
+ );
434
+ } else if (replyMap['error' ] != null ) {
435
+ final Map <Object ?, Object ?> error =
436
+ (replyMap['error' ] as Map <Object ?, Object ?>? )! ;
437
+ throw PlatformException (
438
+ code: (error['code' ] as String ? )! ,
439
+ message: error['message' ] as String ? ,
440
+ details: error['details' ],
441
+ );
442
+ } else if (replyMap['result' ] == null ) {
443
+ throw PlatformException (
444
+ code: 'null-error' ,
445
+ message: 'Host platform returned null value for non-null return value.' ,
446
+ );
447
+ } else {
448
+ return (replyMap['result' ] as String ? )! ;
449
+ }
450
+ }
451
+
452
+ /// Returns the passed in Uint8List.
453
+ Future <Uint8List > echoUint8List (Uint8List arg_aUint8List) async {
454
+ final BasicMessageChannel <Object ?> channel = BasicMessageChannel <Object ?>(
455
+ 'dev.flutter.pigeon.HostIntegrationCoreApi.echoUint8List' , codec,
456
+ binaryMessenger: _binaryMessenger);
457
+ final Map <Object ?, Object ?>? replyMap =
458
+ await channel.send (< Object ? > [arg_aUint8List]) as Map <Object ?, Object ?>? ;
459
+ if (replyMap == null ) {
460
+ throw PlatformException (
461
+ code: 'channel-error' ,
462
+ message: 'Unable to establish connection on channel.' ,
463
+ );
464
+ } else if (replyMap['error' ] != null ) {
465
+ final Map <Object ?, Object ?> error =
466
+ (replyMap['error' ] as Map <Object ?, Object ?>? )! ;
467
+ throw PlatformException (
468
+ code: (error['code' ] as String ? )! ,
469
+ message: error['message' ] as String ? ,
470
+ details: error['details' ],
471
+ );
472
+ } else if (replyMap['result' ] == null ) {
473
+ throw PlatformException (
474
+ code: 'null-error' ,
475
+ message: 'Host platform returned null value for non-null return value.' ,
476
+ );
477
+ } else {
478
+ return (replyMap['result' ] as Uint8List ? )! ;
479
+ }
480
+ }
481
+
380
482
/// A no-op function taking no arguments and returning no value, to sanity
381
483
/// test basic asynchronous calling.
382
484
Future <void > noopAsync () async {
0 commit comments