$declaration constant

BridgeClassDef const $declaration

Compile-type class declaration for MethodChannel

Implementation

static const $declaration = BridgeClassDef(BridgeClassType($type),
    constructors: {
      '': BridgeConstructorDef(
          BridgeFunctionDef(returns: BridgeTypeAnnotation($type), params: [
        BridgeParameter('name',
            BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.string)), false),
        BridgeParameter(
            'codec', BridgeTypeAnnotation($MethodCodec.$type), true),
        BridgeParameter(
            'binaryMessenger',
            BridgeTypeAnnotation($BinaryMessenger.$type, nullable: true),
            true)
      ]))
    },
    getters: {
      'name': BridgeMethodDef(BridgeFunctionDef(
          returns: BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.string)))),
      'codec': BridgeMethodDef(BridgeFunctionDef(
          returns: BridgeTypeAnnotation($MethodCodec.$type))),
      'binaryMessenger': BridgeMethodDef(BridgeFunctionDef(
          returns: BridgeTypeAnnotation($BinaryMessenger.$type))),
    },
    methods: {
      'invokeMethod': BridgeMethodDef(BridgeFunctionDef(
          returns: BridgeTypeAnnotation(
              BridgeTypeRef(CoreTypes.future, [BridgeTypeRef.ref('T')])),
          generics: {
            'T': BridgeGenericParam()
          },
          params: [
            BridgeParameter('method',
                BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.string)), false),
            BridgeParameter('arguments',
                BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.dynamic)), true)
          ])),
      'invokeListMethod': BridgeMethodDef(BridgeFunctionDef(
          returns: BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.future, [
            BridgeTypeRef(CoreTypes.list, [BridgeTypeRef.ref('T')])
          ])),
          generics: {
            'T': BridgeGenericParam()
          },
          params: [
            BridgeParameter('method',
                BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.string)), false),
            BridgeParameter('arguments',
                BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.dynamic)), true)
          ])),
      'invokeMapMethod': BridgeMethodDef(BridgeFunctionDef(
          returns: BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.future, [
            BridgeTypeRef(CoreTypes.map,
                [BridgeTypeRef.ref('K'), BridgeTypeRef.ref('V')])
          ])),
          generics: {
            'K': BridgeGenericParam(),
            'V': BridgeGenericParam()
          },
          params: [
            BridgeParameter('method',
                BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.string)), false),
            BridgeParameter('arguments',
                BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.dynamic)), true)
          ])),
      'setMethodCallHandler': BridgeMethodDef(BridgeFunctionDef(
          returns: BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.voidType)),
          params: [
            BridgeParameter('handler',
                BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.function)), true)
          ])),
    },
    wrap: true);