void main()
{
runApp(MyApp());
}
class MyApp extends StatelessWidget {
final StreamChatClient client;
MyApp(this.client);
}
CodePudding user response:
Yes this will throw an error because you are expecting a parameter
but haven't passed any argument
in it. To solve this you can make your parameter optional
and StreamChatClient
nullable
like below
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
final StreamChatClient? client;
MyApp({this.client});
}
CodePudding user response:
I think it should be like this , because you are creating a constructor and it should be wrapped inside a curly braces. And the required part may be optional for the user to user.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
final StreamChatClient client;
MyApp({required this.client});
]
@override
Widget build(BuildContext context) {