This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:base/base.dart'; | |
import 'package:flutter/material.dart'; | |
class MyScreen extends StatefulWidget { | |
@override | |
_MyScreenState createState() => _MyScreenState(); | |
} | |
class _MyScreenState extends BaseState<MyScreen, MyPresenter> | |
with MyScreenActions { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseState { | |
BaseState._(); | |
factory BaseState.success(dynamic data) = SuccessState; | |
factory BaseState.error(NoodleException error) = ErrorState; | |
factory BaseState.loading() = LoadingState; | |
factory BaseState.done() = DoneState; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:stark/stark.dart'; | |
class LoginViewModel implements Disposable { | |
@override | |
dispose(){ | |
//this method is called when the LoginViewModel is diposed, use to dispose your RX Subjects or Streams | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:stark/stark.dart'; | |
class _MyHomePageState extends State<MyHomePage> with StarkComponent { | |
late ViewModel _viewModel; | |
@override | |
void initState() { | |
super.initState(); | |
_viewModel = get<ViewModel>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:stark/stark.dart'; | |
// get simple injection | |
final MyUseCase useCase = Stark.get(); | |
final useCase = Stark.get<MyUseCase>(); | |
// get named injection | |
final api = Stark.get<Api>(named: "DEFAULT"); | |
// get injection passing params |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:stark/stark.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
void initStark() { | |
Stark.init( | |
[ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:stark/stark.dart'; | |
final myModule = { | |
singleWithParams((i,p) => Api(p["token"])), | |
factoryWithParams((i,p) => MyPresenter(p["view"])), | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:stark/stark.dart'; | |
final myModule = { | |
single((i) => Api(), named: "DEFAULT"), | |
single((i) => Api(), named: "EXTERNAL"), | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:stark/stark.dart'; | |
final theSimpleModule = { | |
single<Repository>((i) => MyRepository(i.get())), | |
factory<AuthUseCase>((i) => SocialAuthUseCase(i.get())), | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:stark/stark.dart'; | |
final appModule = { | |
single((i) => Api()), | |
factory((i) => UseCase(i.get())), | |
}; |