コード例 #1
0
        static string _getErrorMessages(Type flutterOperationType, MethodInfo methodInfo, List <ParameterInfo> parametersInfo, Type returnType)
        {
            if (parametersInfo == null)
            {
                parametersInfo = new List <ParameterInfo>(0);
            }

            StringBuilder builder = new StringBuilder();

            string operationClassName = DartSupport.GetTypeName(flutterOperationType);

            string methodName = methodInfo.Name;

            builder.AppendLine($"Invalid {nameof(PlatformOperationAttribute)} for class {operationClassName}.");
            builder.AppendLine($"Method name: {methodName}");

            if (returnType != null)
            {
                string returnTypeName = DartSupport.GetTypeName(returnType);
                builder.AppendLine($"- Invalid return type: {returnTypeName}");
            }

            foreach (ParameterInfo info in parametersInfo)
            {
                string paramName = info.Name;
                string paramType = DartSupport.GetTypeName(info.ParameterType);
                builder.AppendLine($"- Invalid \"{paramName}\" type: {paramType}");
            }

            return(builder.ToString());
        }
コード例 #2
0
        static string _getErrorMessages2(Type flutterOperationType, MethodInfo methodInfo, string invalidOperationName)
        {
            StringBuilder builder = new StringBuilder();

            string operationClassName = DartSupport.GetTypeName(flutterOperationType);

            string methodName = methodInfo.Name;

            builder.AppendLine($"Invalid {nameof(PlatformOperationAttribute)} for class {operationClassName}, method:{methodName}.");
            //builder.AppendLine($"ID for Method {methodName} => '{invalidOperationName}' is already used by another method!");
            builder.AppendLine($"Cannot exists multiple {nameof(PlatformOperationAttribute)} with the same method name: Function overloading is not supported in Dart at all.");

            return(builder.ToString());
        }