Skip to content

Instantly share code, notes, and snippets.

View D-sense's full-sized avatar
🏠
Online

Adeshina H. D-sense

🏠
Online
View GitHub Profile
@D-sense
D-sense / main.dart
Created October 8, 2018 09:12 — forked from b-cancel/main.dart
FLUTTER => Overriding Back Button in Flutter
import 'package:flutter/material.dart';
import 'dart:async';
void main() => runApp(new BackButtonOverrideDemoWidget());
class BackButtonOverrideDemoWidget extends StatefulWidget{
@override
_BackButtonOverrideDemoWidgetState createState() => new _BackButtonOverrideDemoWidgetState();
}
@D-sense
D-sense / gist:ba80184db3e4514b073501bf076a0576
Created October 8, 2018 10:41
setState() challenge in Flutter
Hello Devs,
I keep in receiving this error message "I/flutter (11828): Another exception was thrown: setState() called in constructor: CartState#040e6(lifecycle state: created, no widget, not mounted)
". I believe this is due to how I'm using setState() method in my CartState class below:
class CartScreen extends StatefulWidget{
createState(){
return CartState();
}
I am getting an error:
type 'Future<dynamic>' is not a subtype of type
'StreamTransformer<List<dynamic>, List<dynamic>>" in my BLOC.
This is the structure of my app:
A BLOC (namely, reports_bloc.com).
A Repository (namely, repository.dart).
A API Provider (namely, api_provider.dart).
@D-sense
D-sense / values_pointers.go
Created February 11, 2019 14:37 — forked from josephspurrier/values_pointers.go
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
Widget build(BuildContext context) {
final mBloc = BlocProvider.mReportsBloc(context);
final fBloc = BlocProvider.fReportsBloc(context);
return DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
elevation: 1.5,
bottom: TabBar(
@D-sense
D-sense / .travis.yml
Created October 3, 2019 14:21 — forked from ryboe/.travis.yml
Example .travis.yml for Golang
# use the latest ubuntu environment (18.04) available on travis
dist: xenial
language: go
# Force-enable Go modules. Also force go to use the code in vendor/
# These will both be unnecessary when Go 1.13 lands.
env:
- GO111MODULE=on
- GOFLAGS='-mod vendor'
@D-sense
D-sense / github-workflows-goreleaser.yml
Created November 23, 2019 08:42 — forked from markbates/github-workflows-goreleaser.yml
Run Go tests in Windows, Mac, Linux. Go version 1.12/1.13 both with Modules and GOPATH.
name: Release
on:
release:
types:
- published
jobs:
release:
name: Release
runs-on: ubuntu-latest
@D-sense
D-sense / go-worker.go
Created February 17, 2020 17:05 — forked from System-Glitch/go-worker.go
A resilient service worker written in Go
package main
// This is an example of a resilient service worker program written in Go.
//
// This program will run a worker, wait 5 seconds, and run it again.
// It exits when SIGINT or SIGTERM is received, while ensuring any ongoing work
// is finished before exiting.
//
// Unexpected panics are also handled: program won't crash if the worker panics.
// However, panics in goroutines started by the worker won't be handled and have
@D-sense
D-sense / traversal.go
Created April 11, 2020 14:26 — forked from denvaar/traversal.go
Depth and Breadth-first traversal in a binary tree, implemented in Golang
package main
import "fmt"
type node struct {
value string
left *node
right *node
}
@D-sense
D-sense / ticket-raffling.go
Last active May 30, 2020 13:12
Ticket-Raffling
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"os"
"time"
)