Skip to content

Instantly share code, notes, and snippets.

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@arashbi
arashbi / bloc-fast-track.dart
Last active May 19, 2023 17:47
Bloc Fast Track
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// https://www.wabisabicity.com/flutter/2022-12-06-futurebuilder/
import 'package:flutter/material.dart';
void main() {
runApp(App());
}
Future<String> getNews() {
return Future<String>.delayed(const Duration(seconds: 3), () async => 'It is getting WARMER!');
}
{
"name": "Charlie",
"surename" : "Jackson",
"age": 26,
"country": "USA"
}
@arashbi
arashbi / main.dart
Created May 24, 2022 03:02
list cast
void main() {
List<num> nums = [1, 2, 3.1];
List<double> doubles = nums.cast<double>();
printList(doubles);
}
void printList(List<double> doubles) {
for (var d in doubles) {
@arashbi
arashbi / main.dart
Created May 17, 2022 19:46
show popup
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
class Car {
String color;
Car(this.color);
}
class Honda extends Car {
String model;
Honda(this.model, super.color);
}
void main() {
Car h = method();
@arashbi
arashbi / CanActivate.dart
Created December 23, 2016 03:51 — forked from kulshekhar/CanActivate.dart
AngularDart sample using CanActivate
import 'dart:html';
import 'package:angular2/core.dart';
import 'package:angular2/router.dart';
@Component(
selector: 'my-app',
styleUrls: const ['app_component.css'],
template: '''
<h1>My First Angular 2 App</h1>
@arashbi
arashbi / vimrc
Created September 28, 2016 21:13
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" Let Vundle manage Vundle
Bundle 'gmarik/vundle'
" My Bundles
@Component({
selector: 'app',
template: `
<div>
{{name}}
<comp
(result)="onChange($event)">
</comp>
</div>
`,