Skip to content

Instantly share code, notes, and snippets.

View MisterJimson's full-sized avatar

Jason Rai MisterJimson

View GitHub Profile
import 'dart:typed_data';
import 'package:http/http.dart' as http;
import 'package:meta/meta.dart';
import 'dart:convert';
bool _isSuccessStatusCode(int code) => (code >= 200 && code < 300);
class ApiResponse<T> {
final int statusCode;
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: TwoPageLayout(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: TwoPageLayout(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: TwoPageLayout(
child: Center(
child: MultiScreenInfo(builder: (info) {
return Column(
@MisterJimson
MisterJimson / README.md
Last active March 28, 2021 02:54 — forked from GroovinChip/README.md
My "Vintage bloc" usage style

My use of the classic (or "vintage") BLoC pattern (not to be confused with Felix Angelov's great bloc library) has evolved over the years. I do no use dedicated sinks for input and dedicated streams for output. Rather, I directly use rxdart's excellent BehaviorSubject directly. BehaviorSubject implements ValueStream, which itself implements Stream, so I found that I could reduce boilerplate a lot by doing this. Values can be directly added to, and read from, a BehaviorSubject. I then use provider to pass my services (I don't really think of them as "bloc"s any more) through my app. This gist provides a real example of how I currently use this pattern.

  • prefs_service.dart is where the service is defined.
  • main.dart shows how to initialize the service.
  • app.dart shows how I use MultiProvider to pass down my service. I always use MultiProvider rather than one single provider to allow for more services. I listen to the BehaviorSubject in my service to set the ThemeMode of my `Ma
@MisterJimson
MisterJimson / error_report.txt
Created April 29, 2021 14:14
error_report.txt
at ? (/_next/static/chunks/10b6e365ec26fe7cfe781d1400fb39e500cbc9dd.8ddfae01087d9249678b.js:1:140675)
at ? (/_next/static/chunks/10b6e365ec26fe7cfe781d1400fb39e500cbc9dd.8ddfae01087d9249678b.js:1:139168)
at a(/_next/static/chunks/10b6e365ec26fe7cfe781d1400fb39e500cbc9dd.8ddfae01087d9249678b.js:1:137986)
for f in $(find ./ -name '*.dart')
do
(echo "// @dart=2.9" && cat $f) > filename1 && mv filename1 $f
done
launch_as() {
local cmd_name=$1
shift
(time $@ || echo $cmd_name >> fail.txt) 2>&1 > $cmd_name.txt
}
time npm ci
launch_as lint npm run lint &
time npm run build
launch_as build1 npm run build:build1 &