This file contains 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'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override |
This file contains 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
///define in module | |
val stateMachineModule = module { | |
stateFactory{ TestImplStateMachine() } bind StateMachine::class | |
} | |
/// inject or get | |
val stateMachineTest:StateMachine<MyState> = getSm() | |
///class of state machine | |
class TestImplStateMachine : StateMachine<MyState> { |
This file contains 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:test/test.dart'; | |
main() { | |
test("throw excpetion test",() { | |
expectException(()=>throw Exception("sample error"), Exception); | |
}); | |
} | |
This file contains 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 MyBlocState{} | |
class Step1State extends MyBlocState{ | |
String title; | |
} | |
class Step2State extends MyBlocState{ | |
int progress; | |
} | |
class Step3State extends MyBlocState{ | |
} |
This file contains 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
bool whenNull(dynamic value) { | |
return value == null; | |
} | |
bool whenNotNull(dynamic value) { | |
return value != null; | |
} | |
bool whenNullMap(String key, value) { |
This file contains 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:fimber/fimber.dart'; | |
// initialization in main.dart | |
Fimber.addTree(DebugTree()); | |
// usage: | |
Fimber.d("Test debug $value"); | |
Fimber.de(exIo, "Error reading file: $path"); |
This file contains 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
08-21 06:39:54.332 1535-4176/? D/MediaSessionService: Sending KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_MEDIA_PLAY_PAUSE, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=0, downTime=0, deviceId=-1, displayId=0, source=0x0 } to the last known PendingIntent PendingIntent{5b76839: PendingIntentRecord{7925b0e com.medium.reader broadcastIntent}} | |
08-21 06:39:54.333 1535-4176/? D/MediaSessionService: Sending KeyEvent { action=ACTION_UP, keyCode=KEYCODE_MEDIA_PLAY_PAUSE, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=0, downTime=0, deviceId=-1, displayId=0, source=0x0 } to the last known PendingIntent PendingIntent{5b76839: PendingIntentRecord{7925b0e com.medium.reader broadcastIntent}} | |
08-21 06:39:54.335 1535-1550/? D/StorageManagerService: getExternalStorageMountMode : 1 | |
getExternalStorageMountMode : 3 | |
getExternalStorageMountMode : final mountMode=1, uid : 10324, packageName : com.medium.reader | |
08-21 06:39:54.335 1535-1550/? I/ApplicationPolicy: isApplicationExternalStorageWh |
This file contains 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
package com.example.playground; | |
import android.os.HandlerThread | |
import android.os.Process | |
/** | |
* Looper based BackgroundThread handler for REalm executions. | |
*/ | |
class BackgroundThread : HandlerThread("Scheduler-Realm-BackgroundThread", Process.THREAD_PRIORITY_BACKGROUND) |
This file contains 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
package com.example.playground; | |
import android.arch.lifecycle.Lifecycle; | |
import android.arch.lifecycle.LifecycleObserver; | |
import android.arch.lifecycle.OnLifecycleEvent; | |
import android.support.annotation.NonNull; | |
import android.util.Log; | |
import java.lang.ref.WeakReference; | |
import java.util.Map; |
This file contains 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
// copied from Reactive X functions - have your own if no need for full Rx in your project. | |
package io.reactivex.functions; | |
/** | |
* A functional interface that takes a value and returns another value, possibly with a | |
* different type and allows throwing a checked exception. | |
* | |
* @param <T> the input value type | |
* @param <R> the output value type | |
*/ |
NewerOlder