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 CounterBloc { | |
final _counterSubject = BehaviorSubject<Int>(); | |
Stream<Int> get counterStream => _counterSubject.stream; | |
} |
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 CounterBloc { | |
final counterSubject = BehaviorSubject<Int>(); | |
} |
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 CounterBloc { | |
final _counterController = StreamController<Int>(); | |
Sink<Int> get _counterSink => _counterController.sink; | |
Stream<Int> get counterStream => _counterControler.stream; | |
} |
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
typealias UseCaseRun<Parameters, ResultType> = (_ parameters: Parameters, _ completion: @escaping (_ result: Result<ResultType, Error>) -> Void ) throws -> Void | |
public class AppResult<ResultType, Parameters> { | |
private var onSuccess: (ResultType) -> Void = {_ in } | |
private var onFailure: (Error) -> Void = {_ in } | |
init( | |
parameters: Parameters, | |
_ useCaseRun: UseCaseRun<Parameters, ResultType> |
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
@ExperimentalCoroutinesApi | |
class MainCoroutineRule( | |
val testDispatcher: TestCoroutineDispatcher = TestCoroutineDispatcher() | |
) : TestWatcher() { | |
override fun starting(description: Description?) { | |
super.starting(description) | |
Dispatchers.setMain(testDispatcher) | |
} |
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 'dart:async'; | |
import 'package:async/async.dart'; | |
import 'package:rxdart/src/rx.dart'; | |
import 'package:rxdart/src/streams/value_stream.dart'; | |
import 'package:rxdart/src/subjects/subject.dart'; | |
import 'package:rxdart/src/transformers/start_with.dart'; | |
import 'package:rxdart/src/transformers/start_with_error.dart'; | |
/// A special StreamController that emits only a item and clean after listen. |
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 java.nio.ByteBuffer | |
import java.security.InvalidKeyException | |
import java.security.NoSuchAlgorithmException | |
import javax.crypto.Mac | |
import javax.crypto.spec.SecretKeySpec | |
class Token @Throws(TokenUriInvalidException::class) constructor(secretText: String) { | |
private val algo: String = "sha1" | |
private val digits: Int = 6 |
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
@ExperimentalCoroutinesApi | |
class RatingViewModelTest { | |
@get:Rule | |
val instantTaskExecutorRule = InstantTaskExecutorRule() | |
private lateinit var viewModel: RatingViewModel | |
private val setRatedCase: SetRated = mock() | |
private val testDispatcher = TestCoroutineDispatcher() |
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
abstract class BaseInteractorTest : KoinTest { | |
@CallSuper | |
@Before | |
open fun setup(){ | |
Dispatchers.setMain(Dispatchers.Unconfined) | |
startKoin { modules(domainModules()) } | |
//declareMock<ErrorHandler>() | |
} |
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 MyCustomPageRoute extends MaterialPageRoute { | |
final Widget previousPage; | |
MyCustomPageRoute({this.previousPage, WidgetBuilder builder, RouteSettings settings}) : super(builder: builder, settings: settings); | |
@override | |
Widget buildTransitions(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget currentPage) { | |
Animation<Offset> _slideAnimationPage1 = Tween<Offset>(begin: Offset(0.0, 0.0), end: Offset(-1.0, 0.0)).animate(animation); | |
Animation<Offset> _slideAnimationPage2 = Tween<Offset>(begin: Offset(1.0, 0.0), end: Offset(0.0, 0.0)).animate(animation); | |
return Stack( | |
children: <Widget>[ |