import 'dart:isolate';
String mainIsolate = '';
String newIsolate = '';
String get isMainIsolate =>
(mainIsolate == Isolate.current.hashCode.toString()) ? '🔴' : '🔵';
void main() async {
mainIsolate = Isolate.current.hashCode.toString();
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 'package:flutter/material.dart'; | |
void main() { | |
runApp(const ExampleApp()); | |
} | |
class ExampleApp extends StatelessWidget { | |
const ExampleApp({super.key}); | |
@override |
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
// 호출 | |
CustomSlider( | |
title: '굵기', | |
min: 1.0, | |
max: 24.0, | |
defaultValue: drawingViewModel.widthValue, | |
onChanged: (newValue) { | |
drawingViewModel.widthValue = newValue; | |
}, | |
); |
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
BoxDecoration( | |
gradient: LinearGradient( | |
stops: [0.0, 1.0], | |
colors: [ | |
Colors.white.withOpacity(0.0), | |
Colors.white, | |
], | |
begin: Alignment.topCenter, | |
end: Alignment.bottomCenter, | |
), |
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
/// 책임 연쇄 패턴 | |
/// Chain Resposibility Pattern | |
/// 요청을 보내는 객체와 요청을 처리하는 객체를 분리해준다. | |
/// 그러므로, 결합도가 낮아진다. | |
/// 로직에 따라서, 다음 request 를 조합하면, 동적으로 변경도 가능하다. | |
/// 원본 : https://sorjfkrh5078.tistory.com/138#:~:text=%EC%B1%85%EC%9E%84%20%EC%97%B0%EC%87%84%20%ED%8C%A8%ED%84%B4%20%28Chain%20of%20Resposibility%20Pattern%29%EC%9D%80%20%ED%96%89%EC%9C%84,%EA%B0%9D%EC%B2%B4%EA%B0%80%20%EC%B2%98%EB%A6%AC%ED%95%98%EC%A7%80%20%EB%AA%BB%ED%95%98%EB%A9%B4%20%EB%8B%A4%EC%9D%8C%20%EA%B0%9D%EC%B2%B4%EB%A1%9C%20%EB%84%98%EC%96%B4%EA%B0%80%EB%8A%94%20%ED%98%95%ED%83%9C%EC%9D%98%20%ED%8C%A8%ED%84%B4%EC%9D%B4%EB%8B%A4. | |
abstract class Handler { | |
void requestHandler(Request request); | |
} |
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
// Source URL : https://medium.com/@gadgetvala/mastering-advanced-enum-in-flutter-3-0-e6f2b42a74b0 | |
// Enhance Enum in Dart | |
enum OperatingSystem with Foo implements Comparable<OperatingSystem> { | |
// Case 를 정의합니다. | |
macOS(true, true), | |
windows(false, true), | |
linux(false, true); | |
// 생성자 메서드 | |
const OperatingSystem( |
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
// 출처: https://flutterbyexample.com/lesson/proxy-provider | |
import 'dart:collection'; | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/material.dart'; | |
class Person with ChangeNotifier { | |
Person({this.name, this.age}); | |
final String name; |
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
void main() { | |
// Device 는 Device 에 대해서 지속적으로 변화가 있을 수 있다. | |
// 그러므로 해당 요구사항은 `Device` 라는 추상클래스로 분리 | |
final tv = TV(); | |
final radio = Radio(); | |
// Remote 기능처럼, 특정 Device 만의 속성이 아닌 경우 | |
// 다시 Remote 클래스 내의 의존성으로 추가되어 사용 | |
// 특정 기능에 대해서는 특정 클래스 대로 발전 가능하도록 분리 | |
final remoteTV = RemoteControl(tv); |