0

In the famous flutter_architecture_samples repo, and exactly in this main.dart, the main function needs 2 arguments:

void main({
  @required TodosInteractor todosInteractor,
  @required UserRepository userRepository,
}) {
  runApp(Injector(
    todosInteractor: todosInteractor,
    userRepository: userRepository,
    child: TodosBlocProvider(
      bloc: TodosListBloc(todosInteractor),
      child: MaterialApp(...

This is the first time I see a flutter main function with arguments, can someone explain? And especially how are you supposed to pass arguments to it.

Abdou Ouahib
  • 821
  • 5
  • 14

1 Answers1

0

There is no way to do that, because when you start an app on your device there are also no parameters that are passed. you can check this How do you pass arguments from command line to main in Flutter/Dart?

Abdelmjid Asouab
  • 170
  • 4
  • 15