Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The parameter cant have a null value #8

Open
RileyManda opened this issue Sep 29, 2021 · 1 comment
Open

The parameter cant have a null value #8

RileyManda opened this issue Sep 29, 2021 · 1 comment

Comments

@RileyManda
Copy link

RileyManda commented Sep 29, 2021

I am experiencing an issue with null values on color and soundNumber:The parameter color and soundNumber cant have a null value

Expanded buildKey({Color color,int soundNumber}) {
    return Expanded(
      child: TextButton(
        child: color,
        onPressed: () {
          playSound(soundNumber);
        },
      ),
    );
  }
@RileyManda
Copy link
Author

RileyManda commented Sep 30, 2021

I am experiencing an issue with null values on color and soundNumber:The parameter color and soundNumber cant have a null value

Expanded buildKey({Color color,int soundNumber}) {
    return Expanded(
      child: TextButton(
        child: color,
        onPressed: () {
          playSound(soundNumber);
        },
      ),
    );
  }

I ended up resolving this by setting Color as required and soundNumber as nullable:
FlatButton is also deprecated in the latest flutter SDK:
So i have to replace that with TextButton instead.But doing so produces an error on the 'color' widget variable (color: color).

buildKey({required Color color, int? soundNumber}) {
   return Expanded(
     child: FlatButton(
       color: color,
       onPressed: () {
         playSound(soundNumber!);
       }, child: const Text(''),
     ),
   );
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant