Skip to content

Instantly share code, notes, and snippets.

View Nikzed's full-sized avatar

Nikzed Nikzed

  • PrivatBank
View GitHub Profile
@Nikzed
Nikzed / main.dart
Created October 4, 2023 08:24
Equatable test
import 'package:equatable/equatable.dart';
void main() {
Immutable i = const Immutable(0);
Set<Immutable> setI = {i};
print(setI.contains(const Immutable(0))); // Prints: true
i = i.copyWith(x: 1);
print(setI.contains(const Immutable(1))); // Prints: false
@Nikzed
Nikzed / gist:e864c76acbc520ee07791fea5aafa351
Created December 27, 2023 07:27
How many lines does your Flutter project have for Windows PowerShell
$totalLines = 0
Get-ChildItem -Recurse -Filter "*.dart" | Where-Object {!($_.Name -like "*.g.dart" -or $_.Name -like "*.freezed.dart" -or $_.Name -like "*.gr.dart" -or $_.Name -like "*.gen.dart")} | ForEach-Object {
$lineCount = (Get-Content $_.FullName | Measure-Object -Line).Lines
$totalLines += $lineCount
Write-Host "$($_.Name): $lineCount lines"
}
Write-Host "Total lines: $totalLines"
@Nikzed
Nikzed / main.dart
Created June 1, 2024 11:21
Dart pad example of approximate device layout
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override