这是indexloc提供的服务,不要输入任何密码
Skip to content

Unexpected inequality from ResizeImage.resizeIfNeeded with same width, height, and image #172642

@Yash-Dhrangdhariya

Description

@Yash-Dhrangdhariya

Steps to reproduce

  • Call ResizeImage.resizeIfNeeded with the same width, height, and NetworkImage URL twice
  • Compare both returned objects using ==

Expected results

  • The two instances should be considered equal (i.e., image1 == image2 should return true) if the parameters are identical

Actual results

  • image1 == image2 returns false, even though the inputs to ResizeImage.resizeIfNeeded are exactly the same

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  final image1 = ResizeImage.resizeIfNeeded(
    400,
    400,
    const NetworkImage('https://example.com/sample.png'),
  );

  final image2 = ResizeImage.resizeIfNeeded(
    400,
    400,
    const NetworkImage('https://example.com/sample.png'),
  );

  // Compare the two images
  print(image1 == image2); // Expected: true, Actual: false
}

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.32.5, on macOS 15.4.1 24E263 darwin-arm64, locale en-IN) [718ms]
    • Flutter version 3.32.5 on channel stable at /Users/user/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fcf2c11572 (4 weeks ago), 2025-06-24 11:44:07 -0700
    • Engine revision dd93de6fb1
    • Dart version 3.8.1
    • DevTools version 2.45.1

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc2) [2.7s]
    • Android SDK at /Users/user/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0-rc2
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.3) [1,611ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16E140
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [13ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.3) [12ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)

[✓] VS Code (version 1.100.2) [11ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.114.0

[✓] Connected device (3 available) [7.6s]
    • sdk gphone64 arm64 (mobile) • emulator-5554             • android-arm64  • Android 13 (API 33) (emulator)
    • macOS (desktop)             • macos                     • darwin-arm64   • macOS 15.4.1 24E263 darwin-arm64
    • Chrome (web)                • chrome                    • web-javascript • Google Chrome 123.0.6312.107

[✓] Network resources [1,758ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterengineflutter/engine repository. See also e: labels.f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions