This file contains hidden or 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
function useAsyncStorageValue<T>(key: string) { | |
const [value, setValue] = useState<T>(); | |
const { getItem, setItem } = useAsyncStorage(key); | |
const readItemFromStorage = async () => { | |
const item = await getItem(); | |
setValue(item != null ? JSON.parse(item) : null); | |
}; | |
const writeItemToStorage = async (newValue: T) => { |
This file contains hidden or 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'; | |
class CustomPage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Container(), | |
floatingActionButton: FloatingActionButton( | |
onPressed: () { | |
showModalBottomSheet( |
This file contains hidden or 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'; | |
class CustomPage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Container(), | |
floatingActionButton: FloatingActionButton( | |
onPressed: () { | |
showModalBottomSheet( |
This file contains hidden or 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
expect.extend({ | |
toHaveBeenCalledWithSome<A>(received: (a: A) => any, argument: (a: A) => void) { | |
const [a] = (received as jasmine.Spy).calls.allArgs()[0]; | |
argument(a); | |
return { | |
message: () => "", |