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
void main() { | |
final list = <int>[1,5,10,11,13,20]; | |
final target =10.50000001; | |
final closestClickedPoint = list.reduce((value, element){ | |
return (element - target).abs() < (value - target).abs() ? element : value; | |
}); | |
print(closestClickedPoint); |
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
@computed | |
Pattern get _regexMasterCard { | |
return RegExp('^(5[1-5]|2(22[1-9]|2[3-9]|[3-6]|7[0-1]|720))'); | |
} | |
@computed | |
Pattern get _regexVisa { | |
return RegExp('[4]'); | |
} |
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:flutter/material.dart'; | |
import 'package:get/get.dart'; | |
class SampleTodoDemo extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return GetMaterialApp( | |
home: TodoPage(), | |
); | |
} |