Skip to content

Instantly share code, notes, and snippets.

@haratak
haratak / modify_string.dart
Created July 14, 2020 05:07
modify_string.dart
import 'dart:core';
void main() {
List<String> texts= ['太郎','個体耳標 12383-0400-7','こたろう','平成 18年 2月 1日生'];
// print('${texts.whereType(String)}');
void getNumber(List<String>texts,String query){
switch(query){
@haratak
haratak / text_overflow.dart
Created May 28, 2020 09:25
textがoverflowした際の挙動をコントロールするためのプロパティ
Text(
'右上のメニューボタンから登録できます',
softWrap: true,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 18),
),
https://dartpad.dartlang.org/
@haratak
haratak / future.dart
Created March 3, 2020 09:12
How to use Future in dart
import 'dart:io';
void main() async {
task1();
String text = await task2();
task3(text);
}
void task1() {
print('task1 completed');
@haratak
haratak / map.dart
Last active March 2, 2020 05:59
Map type in Dart
Map<String ,int> phoneBook = {
'Kyle' : 1234567832,
'Amy' : 1234223543,
'Michel' : 988347345,
};
main(){
print(phoneBook['Amy']);
phoneBook['Kevin'] = 393484728128;
print(phoneBook['Kevin']);
@haratak
haratak / navigate_sample.dart
Created March 2, 2020 03:27
How work navigate in dart
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
title: 'Navigation Basics',
home: FirstRoute(),
));
}
class FirstRoute extends StatelessWidget {