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
void main() { | |
Integer a = 125; | |
Integer b = 125; | |
print(a == b); | |
// true | |
Integer a1 = 128; | |
Integer b2 = 128; | |
print(a == b); | |
// false |
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
void main() { | |
Integer a = 125; | |
Integer b = 125; | |
print(a == b); | |
// true | |
Integer a1 = 128; | |
Integer b2 = 128; | |
print(a == b); | |
// false |
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/cupertino.dart'; | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/material.dart'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} |
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 Bloc<State, Event> : ViewModel() { | |
private val timber by lazy { Timber.tag(javaClass.simpleName) } | |
private val events = Channel<Event>(Channel.UNLIMITED) | |
private var _currentState = ConflatedBroadcastChannel(initialState) | |
protected val currentState: ReceiveChannel<State> | |
get() = _currentState.openSubscription() |
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
class Setter<T> { | |
final T value; | |
Setter(this.value); | |
} | |
Setter<T> set<T>(T value) { | |
return Setter<T>(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:built_value/built_value.dart'; | |
import 'package:built_value/serializer.dart'; | |
part '$name$.g.dart'; | |
abstract class $Name$ implements Built<$Name$, $Name$Builder> { | |
static Serializer<$Name$> get serializer => _$$$name$Serializer; | |
// String get id;$END$ |
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
class MainActivity : AppCompatActivity() { | |
private val userAge by sharedPreference(this, -1) | |
} |
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
class CounterThread : Thread() { | |
private lateinit var handler: Handler | |
override fun run() { | |
Looper.prepare() | |
handler = object: Handler() { | |
private var counter = 100 |
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
/** | |
* FragmentSoftInputCorrector changes a soft input type of activity | |
* for a single fragment that requires SOFT_INPUT_ADJUST_RESIZE | |
* during it is attached to this activity | |
* | |
* Usage inside a fragment: | |
* | |
* override fun onAttach(context: Context) { | |
* super.onAttach(context) | |
* FragmentSoftInputCorrector(activity!!, this) |
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
inline fun <R> Cursor.map(transform: (Cursor) -> R): List<R> { | |
val result = ArrayList<R>(count) | |
while (moveToNext()) { | |
result.add(transform(this)) | |
} | |
return result | |
} |
NewerOlder