0

I am not sure how I can explain my issue clearly here.

I have a graphql mutation inside of flutter which calls an .Net Api to upload a multipart file to Azure blob storage. Here is the bare bones .net api method -

public async Task<Result> UploadFiles(string containerName, List<IFile> files)
        {
            Console.WriteLine("test");
            return new Result
            {
                Status = 200,
            };
        }

The above method will be called from the flutter application like below -

final _fileUploadMutation = """
    mutation(\$containerName: String, \$files: [Upload]) {
      uploadFiles(containerName: \$containerName, files: \$files) {
        status
      }
    }
    """;

  Future<bool> fileUploadMutation(User user) async {
    user.id = '+1416899991';
    print(user.toString());
    String containerName = user.id.substring(
        1);
    QueryResult result = await _client().mutate(
      MutationOptions(document: gql(_fileUploadMutation), variables: {
        "containerName": containerName,
        "files": user.files
      } // this
          ),
    );
    print(result);
    if (result.hasException) {
      print(result.exception?.graphqlErrors[0].message);
    } else if (result.data != null) {
      //user.avatarUrl = result.data!['UploadFiles'][0];
      user.avatarUrl = 'www.bol.com';
      return true;
    }
    return false;
  }

When the code runs I get a HttpLinkParserException error thrown which says FormatException: Unexpected end of input (at character 1)

enter image description here

Sumchans
  • 3,088
  • 6
  • 32
  • 59

1 Answers1

0

You're getting a 404 error because http://192.168.1.117:7133/api/graphql/ is not the right endpoint.

You need to configure your flutter app to point to the correct URL, although it's not clear from your code what that is.

Joundill
  • 6,828
  • 12
  • 36
  • 50