var state = {
id: 1,
points: 100,
name: "Goran"
};
var newState = {
This file contains 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
Disclaimer: The instructions are the collective efforts from a few places online. | |
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did. | |
First off, bundle. | |
================== | |
1. cd to the project directory | |
2. Start the react-native packager if not started | |
3. Download the bundle to the asset folder: | |
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle" |
This file contains 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
// Arrays & Objs Without Mutations | |
var list = ['1', '2', '3']; | |
var obj = {item: 1, blob: 2}; | |
// Adds item to array | |
list.concat(['4', '5']); | |
[...list, [4, 5]]; |
Workbox runtime caching recipes
Your Service Worker script will need to import in Workbox and initialize it before calling any of the routes documented in this write-up, similar to the below:
importScripts('workbox-sw.prod.v1.3.0.js');
const workbox = new WorkboxSW();
// Placeholder array populated automatically by workboxBuild.injectManifest()
just the bare necessities of state management.
Hotlink it from https://unpkg.com/valoo
.
This file contains 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/gestures.dart'; | |
import 'package:flutter/material.dart'; | |
//Main function. The entry point for your Flutter app. | |
void main() { | |
runApp( | |
MaterialApp( | |
home: Scaffold( | |
body: DemoApp(), | |
), |
This file contains 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
extension AsValueListenable<T> on Stream<T> { | |
/// Converts a [Stream] to a [ValueListenable] | |
/// | |
/// The internal [StreamSubscription] is cancelled when | |
/// all listeners added to [ValueListenable] are removed. | |
/// Keep this in mind as this could cause issues with | |
/// single-subscription streams. | |
ValueListenable<T> asValueListenable(T initialValue) { | |
return _StreamValueListenable(this, initialValue); | |
} |
This file contains 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
# Set the platform at the top | |
platform :ios, '13.0' | |
# Rest of the pod file | |
# Update post_install step | |
post_install do |installer| | |
# Ensure pods use the minimum deployment target set above | |
# https://stackoverflow.com/a/64385584/436422 | |
pods_project = installer.pods_project |
This file contains 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'; | |
import 'dart:async'; | |
import 'package:flutter_riverpod/flutter_riverpod.dart'; | |
final testStreamProvider = StreamProvider<int>((ref) { | |
return Stream.periodic(const Duration(seconds: 2), (count) { | |
return count; | |
}); | |
}); |