Skip to content

image_picker_ios has "Conditional downcast" and "Comparing non-optional value to nil" Swift warnings #194603

Closed
flutter/packages
#13299

Description

@jmagman
Testing failed:
	Conditional downcast from '[String]?' to '[String]' does nothing
	Conditional downcast from '[String]?' to '[String]' does nothing
	Conditional downcast from '[String]?' to '[String]' does nothing
	Conditional downcast from '[String]?' to '[String]' does nothing
	Comparing non-optional value of type 'UIViewController' to 'nil' always returns true

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8667765278421871425/+/u/Run_package_tests/native_test/stdout

/Volumes/Work/s/w/ir/x/w/packages/packages/image_picker/image_picker_ios/example/ios/RunnerTests/ImagePickerPluginTests.swift:536:24: error: conditional downcast from '[String]?' to '[String]' does nothing
        #expect(result as? [String] == [])
                ~~~~~~~^~~~~~~~~~~~
                      
@__swiftmacro_11RunnerTests0033ImagePickerPluginTestsswift_DbGHjfMX535_8_33_30E27F9AB39617F94411F8AEA4811548Ll6expectfMf_.swift:1:39: error: conditional downcast from '[String]?' to '[String]' does nothing
Testing.__checkBinaryOperation(result as? [String],{ $0 == $1() },[],expression: .__fromBinaryOperation(.__fromSyntaxNode("result as? [String]"),"==",.__fromSyntaxNode("[]")),comments: [],isRequired: false,sourceLocation: Testing.SourceLocation.__here()).__expected()
                               ~~~~~~ ^   ~~~~~~~~
/Volumes/Work/s/w/ir/x/w/packages/packages/image_picker/image_picker_ios/example/ios/RunnerTests/ImagePickerPluginTests.swift:536:9: note: in expansion of macro 'expect' here
        #expect(result as? [String] == [])
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Work/s/w/ir/x/w/packages/packages/image_picker/image_picker_ios/example/ios/RunnerTests/ImagePickerPluginTests.swift:536:9: note: in expansion of macro 'expect' here
        #expect(result as? [String] == [])
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Work/s/w/ir/x/w/packages/packages/image_picker/image_picker_ios/example/ios/RunnerTests/ImagePickerPluginTests.swift:552:24: error: conditional downcast from '[String]?' to '[String]' does nothing
        #expect(result as? [String] == [])
                ~~~~~~~^~~~~~~~~~~~
                      
@__swiftmacro_11RunnerTests0033ImagePickerPluginTestsswift_DbGHjfMX551_8_33_30E27F9AB39617F94411F8AEA4811548Ll6expectfMf_.swift:1:39: error: conditional downcast from '[String]?' to '[String]' does nothing
Testing.__checkBinaryOperation(result as? [String],{ $0 == $1() },[],expression: .__fromBinaryOperation(.__fromSyntaxNode("result as? [String]"),"==",.__fromSyntaxNode("[]")),comments: [],isRequired: false,sourceLocation: Testing.SourceLocation.__here()).__expected()
                               ~~~~~~ ^   ~~~~~~~~
/Volumes/Work/s/w/ir/x/w/packages/packages/image_picker/image_picker_ios/example/ios/RunnerTests/ImagePickerPluginTests.swift:552:9: note: in expansion of macro 'expect' here
        #expect(result as? [String] == [])
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Work/s/w/ir/x/w/packages/packages/image_picker/image_picker_ios/example/ios/RunnerTests/ImagePickerPluginTests.swift:552:9: note: in expansion of macro 'expect' here
        #expect(result as? [String] == [])
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Work/s/w/ir/x/w/packages/packages/image_picker/image_picker_ios/example/ios/RunnerTests/ImagePickerPluginTests.swift:763:72: error: comparing non-optional value of type 'UIViewController' to 'nil' always returns true
    #expect(plugin.presentingViewControllerForImagePickerInNewWindow() != nil)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~

Note this isn't currently being caught in CI due to #194517

Activity

  1. changed the title [-]image_picker_ios has really minor "Conditional downcast" and "Comparing non-optional value to nil" warnings[/-] [+]image_picker_ios has "Conditional downcast" and "Comparing non-optional value to nil" Swift warnings[/+] on Oct 16, 2026
  2. self-assigned this
    on Oct 16, 2026
  3. github-actions commented on Oct 31, 2026

    @github-actions

    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 -v and a minimal reproduction of the issue.

  4. locked as resolved and limited conversation to collaborators on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

p: image_pickerThe Image Picker plugin.platform-iosiOS applications specificallyteam-iosOwned by iOS platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions