Skip to content

Instantly share code, notes, and snippets.


Venkat Dinavahi venkatd

View GitHub Profile
View where-not-in.dart
void main() {
final lst1 = ["t1" , "t2" , "t3" , "t4"];
final lst2 = ["t2" , "t4" , "t5"];
final diff = lst1.whereNotIn(lst2).toList();
extension WhereNotInExt<T> on Iterable<T> {
Iterable<T> whereNotIn(Iterable<T> reject) {
final rejectSet = reject.toSet();
View rewrite_imports.dart
import 'dart:io';
import 'package:file/local.dart';
import 'package:glob/glob.dart';
import 'package:path/path.dart' as path;
void main(List<String> args) async {
assert(args.length == 1);
await updateRelativeImportsInPackage(args[0]);
venkatd / separated.dart
Created Dec 19, 2020
If you want to add some space in your rows/columns, can give this a try.
View separated.dart
import 'package:flutter/widgets.dart';
class SeparatedRow extends StatelessWidget {
const SeparatedRow({
@required this.separator,
@required this.children,
this.mainAxisAlignment = MainAxisAlignment.start,
this.mainAxisSize = MainAxisSize.max,
this.crossAxisAlignment =,
}) : assert(separator != null),
View expandable_section.dart
import 'package:flutter/widgets.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
// adapted from
class ExpandableSection extends HookWidget {
const ExpandableSection({
Key key,
this.expanded = false,
View line_metrics_debug.dart
import 'package:flutter/widgets.dart';
// original credit to
class LineMetricsDebug extends StatelessWidget {
venkatd / index.js
Created Sep 22, 2020
Netlify plugin for Flutter
View index.js
// @ts-check
const fs = require('fs')
const url = require('url')
const path = require('path')
const { promisify } = require('util')
const exists = promisify(fs.exists)
const readFile = promisify(fs.readFile);
const writeFile = promisify(fs.writeFile)

Composition challenges

  • State management
    • pending messages
    • file upload progress
    • replacing the initState logic in ChatScreen
  • Reusing screens
    • Time entry edit vs. create time entry
    • popping screen returns value?
View watch
echo "Compiling $PWD to $OUTPUT_PATH whenever a *.go file changes..."
fswatch -e “.*” -i “\\.go$” . | xargs -n1 -I{} go build -v -o $OUTPUT_PATH
View minty.ex
defmodule Minty do
defmodule Response do
defstruct [:status, :headers, :data]
def request(method, url, opts \\ []) do
%{scheme: scheme, host: host, port: port, path: path} = URI.parse(url)
payload = Keyword.get(opts, :payload)
headers = Keyword.get(opts, :headers, [])
View play.dart
import 'dart:io';
Future<void> startPlayServer(int port) async {
HttpServer server = await HttpServer.bind(
await for (var request in server) {