Repository navigation
New in 3.32: Couldn't resolve native function 'ImageFilter::equal' in 'dart:ui' #169936
Description
Steps to reproduce
This is a new error that first appeared in 3.32:
ArgumentError (Invalid argument(s): Couldn't resolve native function 'ImageFilter::equal' in 'dart:ui' : Couldn't resolve function: 'ImageFilter::equal'
It comes from using a GLSL filter via ImageFilter.shader and then changing the parameters that the shader receives. The error is then thrown on line 91 of image_filter.dart ( if (value != _imageFilter) ) or line 2008 in layer.dart ( if (value != _imageFilter) )
Downgrading to 3.29.3 solves the problem and the app runs fine.
Expected results
Above code runs without errors (as it did in 3.29.3).
Actual results
Code produces error ArgumentError (Invalid argument(s): Couldn't resolve native function 'ImageFilter::equal' in 'dart:ui' : Couldn't resolve function: 'ImageFilter::equal'
Code sample
Code sample
import 'dart:ui';
import 'package:flutter/material.dart';
class Test332GlslError extends StatelessWidget
{
final intensity = ValueNotifier(1.0);
Future<FragmentShader> get loadShader async {
final program = await FragmentProgram.fromAsset('shaders/mono.frag');
return program.fragmentShader();
}
Widget build(context)
{
return Stack(
alignment: Alignment.center,
children: [
FutureBuilder(
future: loadShader,
builder: (_, snapshot) {
if (snapshot.connectionState != ConnectionState.done) return Container();
return ValueListenableBuilder<double>(
valueListenable: intensity,
builder: (_, value, child) {
return ImageFiltered(
imageFilter: ImageFilter.shader(
snapshot.data!
..setFloat(0, 100)
..setFloat(1, 100)
..setFloat(2, 0)
..setFloat(3, value),
),
child: Container(color: Colors.red),
);
});
},
),
IconButton(
onPressed: () => intensity.value = (intensity.value == 1) ? .5 : 1,
icon: const Icon(Icons.change_circle, size: 100),
),
],
);
}
}#version 460 core
#include <flutter/runtime_effect.glsl>
uniform vec2 resolution;
uniform float oncolor;
uniform float intensity;
uniform sampler2D img;
out vec4 result;
vec4 clampColor(vec4 c) {
return clamp(c, 0., 1.);
}
void main() {
vec2 uv = FlutterFragCoord() / resolution;
result = texture(img, uv);
float val = 0;
if(oncolor == 0.)
val = result.r;
else if(oncolor == 1.)
val = result.g;
else
val = result.b;
float r = pow(val * intensity * 1., 1 / 1.1);
float g = pow(val * intensity * .72, 1 / .95);
float b = pow(val * intensity * .44, 1 / 1.04);
result = vec4(r, g, b, result.a);
result = clampColor(result);
}Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
The following ArgumentError was thrown during a scheduler
callback:
Invalid argument(s): Couldn't resolve native function
'ImageFilter::equal' in 'dart:ui' : Couldn't resolve function:
'ImageFilter::equal'.
When the exception was thrown, this was the stack:
#0 Native._ffi_resolver.#ffiClosure0 (dart:ffi-patch/ffi_patch.dart)
#1 Native._ffi_resolver_function (dart:ffi-patch/ffi_patch.dart:1896:20)
ffi_patch.dart:1896
#2 _FragmentShaderImageFilter._equals (dart:ui/painting.dart)
#3 _FragmentShaderImageFilter.== (dart:ui/painting.dart:4492:9)
painting.dart:4492
#4 ImageFilterLayer.imageFilter= (package:flutter/src/rendering/layer.dart:2008:15)
layer.dart:2008
#5 _ImageFilterRenderObject.updateCompositedLayer (package:flutter/src/widgets/image_filter.dart:106:11)
image_filter.dart:106
#6 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:157:46)
object.dart:157
#7 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:121:5)
object.dart:121
#8 PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1312:31)
object.dart:1312
#9 PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1322:15)
object.dart:1322
#10 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:631:23)
binding.dart:631
#11 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1242:13)
binding.dart:1242
#12 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:495:5)
binding.dart:495
#13 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1438:15)
binding.dart:1438
#14 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1351:9)
binding.dart:1351
#15 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1204:5)
binding.dart:1204
#16 _invoke (dart:ui/hooks.dart:331:13)
hooks.dart:331
#17 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:444:5)
platform_dispatcher.dart:444
#18 _drawFrame (dart:ui/hooks.dart:303:31)Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.32.1, on macOS 15.5 24F74 darwin-arm64, locale
en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.100.2)
[✓] Connected device (3 available)
! Error: Browsing on the local area network for cpgPhone11. Ensure the device
is unlocked and attached with a cable or associated with the same local area
network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code
-27)
[✓] Network resources
• No issues found!
Activity
mraleph commentedon Jun 4, 2025
Broken by 1e2583e (cc @jonahwilliams) there is a typo - should be
ImageFilter::equals.We should probably have an eager binding mode for natives to catch issues like these (cc @dcharkes @goderbauer)
darshankawar commentedon Jun 4, 2025
I was able to replicate this with 3.32.1 on both platforms (android and iOS) and based on above findings, labeling as regression.
a-siva commentedon Jun 4, 2025
Looks like this is not a dart issue, removing the 'dart dependency' label.
Please open a new issue for supporting eager bind mode if that would be helpfull
Make ImageFilter::equals a static method and fix the name in its FFI …
Make ImageFilter::equals a static method and fix the name in its FFI …
Make ImageFilter::equals a static method and fix the name in its FFI …
Squashed commit of the following:
github-actions commentedon Jun 20, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.Make ImageFilter::equals a static method and fix the name in its FFI …