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
struct SomeView: View { | |
var body: some View { | |
VStack { | |
List(1...10) { item in | |
Text("Item number \(item)") | |
} | |
.refreshable { | |
//enter code to execute during refresh here | |
} | |
} |
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
var list = [1, 2, 3]; | |
list.forEach((v) => print(v * 10)); |
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:meta/meta.dart'; | |
int sum(List<int> list, [int initial = 0]) { | |
var total = initial; | |
list.forEach((v) => total += v); | |
return total; | |
} | |
String joinToString(List<String> list, | |
{@required String separator, String prefix = ", String | |
suffix = "}) => | |
'$prefix${list.join(separator)}$suffix'; |
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
WebSocket.connect('ws://demos.kaazing.com/echo'). | |
then((WebSocket webSocket) { | |
webSocket.listen(print, onError: print); | |
webSocket.add('hello'); | |
webSocket.add('world'); | |
webSocket.close(); | |
}).catchError(print); |
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
// Example of using the optional() helper | |
print optional($dessert->name)->category; |
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
// We import the support for this helper | |
use Illuminate\Support\Str; | |
// We use the helper | |
echo($imagename) Str::uuid(); | |
// We get a random identifier | |
6e358c39-9663-4a1f-b911-4fd6baaa5b1c |
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
// We import the support for this Helper | |
use Illuminate\Support\Arr; | |
$products = ['drinks' => ['Name' => 'Strawberry Juice', 'price' => '3.60']]; | |
$check = Arr::has($products, 'drinks.name'); | |
// We get true | |
$check = Arr::has($products, ['drinks.name', 'drinks.price']); |
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
$url = Str::slug('Shameem Reza', '+'); | |
// We get the following friendly URL | |
shameem+reza |
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
$url = Str::slug('Shameem Reza'); | |
// We get the following friendly URL | |
gelatina-de-fresa |
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
// We analyze if there are blank or null values | |
blank(''); | |
blank(' '); //Here we have blank spaces | |
blank(null); | |
// If there is a blank value or blank spaces we get 'true' | |
blank(0); | |
blank(true); | |
blank(false); |