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'; | |
| extension CustomColorScheme on ColorScheme { | |
| Color get success => brightness == Brightness.light ? const Color(0xFF28a745) : const Color(0x2228a745); | |
| } |
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
| analyzer: | |
| errors: | |
| # treat missing required parameters as a warning (not a hint) | |
| missing_required_param: warning | |
| # treat missing returns as a warning (not a hint) | |
| missing_return: warning | |
| linter: | |
| rules: | |
| - always_declare_return_types |
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
| pre-commit: | |
| piped: true | |
| commands: | |
| linter: | |
| run: flutter analyze lib | |
| sort-imports: | |
| glob: "*.dart" | |
| run: flutter pub run import_sorter:main {staged_files} && git add {staged_files} | |
| pretty: | |
| glob: "*.dart" |
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:map_enhancer/map_enhancer.dart'; | |
| void main() { | |
| final Map peter = { | |
| 'name': { | |
| 'firstName': 'Peter', | |
| 'lastName': 'Petrelli', | |
| }, | |
| 'age': 29, | |
| }; |
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
| Metric(Memory usage)\No. of logo | 10 | 100 | 1000 | |
|---|---|---|---|---|
| Capacity(Use const constructor) | 7.7MB | 9.96MB | 27.3MB | |
| Used(Use const constructor) | 4.4MB | 4.3MB | 16.8MB | |
| Capacity(Use non-const constructor) | 7.7MB | 10.9MB | 29.4MB | |
| Used(Use non-const constructor) | 4.3MB | 5.4MB | 22.1MB |
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
| Metric(Time to draw each frame)\No. of logo | 10 | 100 | 1000 | |
|---|---|---|---|---|
| GPU (Use const constructor) | 7.4ms | 9.6ms | 50ms | |
| UI (Use const constructor) | 4.8ms | 10.6ms | 78ms | |
| GPU (Use non-const constructor) | 7.4ms | 9.6ms | 56ms | |
| UI (Use non-const constructor) | 5.4ms | 11.7ms | 84.1ms |
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
| Listener( | |
| onPointerSignal: (PointerSignalEvent event) { | |
| if (event is PointerScrollEvent) { | |
| print('x: ${event.position.dx}, y: ${event.position.dy}'); | |
| print('scroll delta: ${event.scrollDelta}'); | |
| } | |
| }, | |
| child: child, | |
| ) |
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
| MouseRegion( | |
| onEnter: (PointerEnterEvent event) { | |
| print('x: ${event.position.dx}, y: ${event.position.dy}'); | |
| }, | |
| onHover: (PointerHoverEvent event) { | |
| print('x: ${event.position.dx}, y: ${event.position.dy}'); | |
| }, | |
| onExit: (PointerExitEvent event) { | |
| print('x: ${event.position.dx}, y: ${event.position.dy}'); | |
| }, |
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
| const R = require('ramda') | |
| const aws = require('aws-sdk') | |
| const batchWriteToDb = async (tableName, data) => { | |
| const dynamoDb = new aws.DynamoDB({ | |
| maxRetries: 999 | |
| }) | |
| const docClient = new aws.DynamoDB.DocumentClient({ | |
| service: dynamoDb, | |
| convertEmptyValues: true | |
| }) |
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
| // Good | |
| class MyWidget extends StatelessWidget { | |
| final List<int> numbers = []; | |
| @override | |
| Widget build(BuildContext context) { | |
| return Container( | |
| child: Conditional.single( | |
| context: context, | |
| conditionBuilder: (BuildContext context) { |
NewerOlder