when I run the folder picker after creating a new tab, the app returns Null and an error occurs.

武石 中村 0 Reputation points
2023-05-02T10:45:12.2366667+00:00

Right now I am trying to create a TabView based photo app in the WinUI3 development environment.

I am trying to create an app where every time I create a new tab, a tab with the same content is created.

The content of the tabs will implement a folder picker function.

However, when I run the folder picker after creating a new tab, the app returns Null and an error occurs.

Why is this?

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,603 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,041 Reputation points
    2023-05-03T14:00:28.5666667+00:00
    Hello there,
    
    This error occurs when you use a bang operator (!) on a nullable instance which wasn't initialized.
    
    For example:
    
    String? string; // Nullable String
    
    void main() {
      var len = string!.length; // Runtime error: Null check operator used on a null value
    }
    
    Solutions:
    Open the logs and there must be a line pointing to a file in your project where the error occurred.
    
    Hope this resolves your Query !!
    
    --If the reply is helpful, please Upvote and Accept it as an answer--
    
    0 comments No comments