I'm looking to use wit.ai for speech recognition. This is the post method I'm using to post audio file.

  Future<http.Response> post(
    String path,
    File file,
  ) async {
    final client = http.Client();

    try {
      final uri = Uri.parse('https://api.wit.ai/$path');
      final len = file.lengthSync();

      final request = http.StreamedRequest('POST', uri)
          'Authorization': 'Bearer $api_key',
          'Content-Type': 'audio/wav',
          'Transfer-encoding': 'chunked'
        ..contentLength = len;

      file.openRead().listen((chunk) {
      }, onDone: () {

      final res = await request.send().then(http.Response.fromStream);

      return res;
    } catch (e) {
    } finally {

Wit.ai seems to limit audio length to 20 seconds. So, I tried to send a chunked request. I've never worked with chunked requests before and I expected it to send smaller chunks and get stream of response for each chunk seperately. But it seems that the request is sent once only and I'm still getting audio length exceeded error. Am I doing something wrong and Is it possible to get text for audio of length more than 20 seconds from wit speech api?