Skip to content

Instantly share code, notes, and snippets.

View ibrohimkhan's full-sized avatar
🏠
Working from home

Ibrokhim Kholmatov ibrohimkhan

🏠
Working from home
View GitHub Profile
import 'dart:io';
void main() {
testInputAsStream();
}
// with async/await
void testFutureWithAsync() async {
var data = await inputAsFuture();
print('Введена строка $data');
class User {
User(this.firstName, this.lastName);
String firstName;
String lastName;
@override
String toString() => '$firstName $lastName';
}
import 'dart:math';
void main() {
task1();
print(task2(numbers: [1, 2, 3, 4]));
print(task4());
}
void task1([String a = 'hello world']) => print(a.split(' ').reversed.join(' '));
import 'dart:io';
void main(List<String> arguments) {
task1();
}
void task1() {
var month = 8;
switch (month) {
late int a; // task 1, global variable; must be initialized before usage
void task2() {
double? b; // local variable
}
void task3() {
var text = 'some text';
// a = text; // invalid assignment, A value of type String can't be assigned to a variable of type int
}

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one