Repository: flutter
Issue: `Image` does not re-resolve `NetworkImage` on changed (auth) headers
Labels: framework,a: images,has reproducible steps,P2,found in release: 3.7,found in release: 3.8,team-framework,triaged-framework

Using the `Image` widget with a `NetworkImage` that requires authentication headers with limited duration:
```dart
Image(
  image: NetworkImage(
    myConstantUrl,
    headers: {
      "Authorization": "Bearer $myTokenWithLimitedValidity",
    },
  ),
  errorBuilder: (_, Object error, ___) {
    if (error is NetworkImageLoadException && error.statusCode == 401) {
      SchedulerBinding.instance.addPostFrameCallback((_) {
        updateMyTokenWithLimitedValidity();
      });
    }
    return Container();
  },
)
```

does not cause `Image` to  `_resolveImage()` in `didUpdateWidget`:
```dart
// from image.dart
@override
  void didUpdateWidget(Image oldWidget) {
    super.didUpdateWidget(oldWidget);
    // ...
    if (widget.image != oldWidget.image) {
      _resolveImage();
    }
  }
```

because headers are not included in `NetworkImage` equality:

```dart
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  test('url equality', () async {
    const url1 = NetworkImage("url1");
    const url2 = NetworkImage("url2");
    expect(url1 == url1, isTrue); // OK
    expect(url1 == url2, isFalse); // OK
  });

  test('header equality', () async {
    const url1 = NetworkImage("url", headers: {"Authorization": "Bearer 1"});
    const url2 = NetworkImage("url", headers: {"Authorization": "Bearer 2"});
    expect(url1 == url1, isTrue); // OK
    expect(url1 == url2, isFalse); // Expected: false - Actual: <true>
  });
}
```

The current workaround is to pass a `ValueKey`  (that contains or changes with the token) into `Image` to get a fresh state.


____
```
$ flutter doctor -v
[✓] Flutter (Channel stable, 3.3.10, on macOS 12.1 21C52 darwin-arm, locale en-DE)
    • Flutter version 3.3.10 on channel stable at /Users/moin/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 135454af32 (7 weeks ago), 2022-12-15 07:36:55 -0800
    • Engine revision 3316dd8728
    • Dart version 2.18.6
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/moin/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13C100
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • 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 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.74.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.58.0

[✓] Connected device (3 available)
    • iPhone 8 (mobile) • 96D15531-910E-4AE3-9872-11A84E74BAB0 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • macOS (desktop)   • macos                                • darwin-arm64   • macOS 12.1 21C52 darwin-arm
    • Chrome (web)      • chrome                               • web-javascript • Google Chrome 109.0.5414.119

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```