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 'dart:io'; | |
import 'dart:math'; | |
import 'package:adivery/adivery.dart'; | |
import 'package:adivery/adivery_ads.dart'; | |
import 'package:bloc/bloc.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:freemake/apps/home/home_repository.dart'; | |
part 'ad_state.dart'; |
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
const cartItem = [ | |
{ | |
title: 'Book1', | |
exist: false | |
}, { | |
title: 'Book2', | |
exist: true | |
}, { | |
title: 'Book3', | |
exist: true |
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
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async { | |
if (message.data['message'] == 'Calling message') { | |
showCallNotification( | |
3, message.data['chatroomid'], message.data['userName']); | |
} | |
await Firebase.initializeApp(); | |
} | |
void main() async { |
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
fun main() { | |
val immutableList = listOf(1,2,3,4,5,6,7) //(1) | |
println("Immutable List $immutableList") | |
val mutableList = immutableList.toMutableList() //(2) | |
println("Mutable List $mutableList") | |
mutableList.add(8) //(3) | |
println("Mutable List after add $mutableList") | |
println("Mutable List after add $immutableList") | |
} |
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 MutableObj { | |
var value = "" | |
override fun toString(): String { | |
return "MutableObj(value='$value')" | |
} | |
} | |
fun main() { | |
val mutableObj:MutableObj = MutableObj()//(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
val myOtherValue = MyOtherValue("Foo") | |
myOtherValue.value = "Bar" // This will not compile because value cannot be reassigned |
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 MyOtherValue(default: String) { | |
lateinit var value: String | |
private set | |
} |
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
val mutable = MyValue.Mutable("Foo") | |
val immutable = MyValue.Immutable("Foo") | |
mutable.value = "Bar" // This is fine | |
immutable.value = "Bar" // This will not compile because value cannot be reassigned | |
val mutated = immutable.mutate() | |
mutated.value = "Bar" // This is fine |
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
sealed class MyValue(default: String) { | |
open val value: String = default | |
class Immutable(default: String): MyValue(default) { | |
fun mutate(): Mutable = Mutable(value) | |
} | |
class Mutable(default: String) : MyValue(default) { | |
fun immutate(): Immutable = Immutable(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
val space = Space() | |
println(space.all) // result 47 | |
val squares = 30 | |
space.squares = squares * 2 | |
println(space.all) // result 84 |
NewerOlder