Skip to content

Wrong type recognizing after null check block #59894

@ChaserVasya

Description

@ChaserVasya

Snippet

extension NotEmptyOrThrowTExtension<String> on String? {
  String notEmptyOrThrow(Object exception) {
    final self = this;
    if (self == null) {
      throw exception;
    }
    if (self.isEmpty) {
      return self;
    }
    return self;
  }
}

Actual behavior

Снимок экрана 2025-01-13 в 19 16 07

Expected behavior

isEmpty is recognized.

Version

Dart SDK version: 3.5.4 (stable) (Wed Oct 16 16:18:51 2024 +0000) on "macos_arm64"

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-as-intendedClosed as the reported issue is expected behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions