[Flutter/dart] null check operator used on a null value messaging
Overview
A title error has occurred at FirebaseMessaging.onBackgroundMessage().
Cause and Solution
The delegate passed to the argument of the above method must be a top-level function. In my case, I was passing an instance method, so the error occurred.
The error disappeared when the method passed was a top-level function.
@main.dart
void main() async{
//・・・
FirebaseMessaging.onBackgroundMessage(onBackGround);
}
Future<void> onBackGround(RemoteMessage message)async{
//・・・
}
Reference
Recent Posts
See AllWhat want to do I want to create an input form using TextField. For example, if the input content is a monetary amount, I would like to...
What want to do There is a variable that remain unchanged once the initial value is determined. However, it cannot be determined yet when...
What want to do As the title suggests. Place two widgets in one line on the screen One in the center of the screen and the other on the...
Comments