8000 statObject method is crashing with Error: Null check operator used on a null value · Issue #108 · xtyxtyx/minio-dart · GitHub
[go: up one dir, main page]

Skip to content

statObject method is crashing with Error: Null check operator used on a null value #108

Description

@BirjuVachhani

When calling statObject method with a valid, existent bucket and object key crashes with Null check operator used on a null value at following line:

return StatObjectResult(
      etag: etag,
      size: int.parse(resp.headers['content-length']!), // <------ Here
      metaData: extractMetadata(resp.headers),
      lastModified: parseRfc7231Time(resp.headers['last-modified']!),
      acl: retrieveAcls ? await getObjectACL(bucket, object) : null,
    );

Stacktrace:

Null check operator used on a null value
#0      Minio.statObject (package:minio/src/minio.dart:1136:53)
<asynchronous suspension>
#1      Future.timeout.<anonymous closure> (dart:async/future_impl.dart:1061:7)
<asynchronous suspension>

I debugged it and turns out, resp.headers is missing content-length field, hence the crash. I also noticed that size is a nullable param. So this can easily be solved by using int.tryParse instead of int.parse (Unless it is a real deep issue!).

Activity

  1. added a commit that references this issue on Nov 26, 2025
    0c5f55d
  2. arrrrny commented on Oct 22, 2026

    @arrrrny

    Fixed in the fork. statObject no longer reads content-length and
    last-modified with the bang operator — both are optional in a HEAD answer,
    so both are parsed defensively and the result fields stay nullable:

    final contentLength = resp.headers['content-length'];
    final lastModified = resp.headers['last-modified'];

    A regression test named after this issue is in
    test/minio_regressions_test.dart.

  3. arrrrny commented on Oct 22, 2026

    @arrrrny

    This ships in zuraffa_minio — the maintained fork of this package, which upstream has not touched since August 2025.

    The fork keeps the API of the original package unchanged, so moving over is an import swap:

    // before
    import 'package:minio/minio.dart';
    // after
    import 'package:zuraffa_minio/minio.dart';

    Source, the changelog and the sweep of the open issues of this tracker: https://github.com/arrrrny/zuraffa_minio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0