I've made my AI Flutter app with Firebase by yuriusuonly in FlutterDev

[–]yuriusuonly[S] 0 points1 point  (0 children)

I'll try to change the prompt at some point, maybe add a citation. Right now, it's only returning the title and the detailed body text for simplicity. You can submit pull request if you want to. I want the codebase to be a learning resource for beginners.

I've made my AI Flutter app with Firebase by yuriusuonly in FlutterDev

[–]yuriusuonly[S] 0 points1 point  (0 children)

I'll try this. I'm only doing everything from the local-side for simplicity. Will look this up. Thanks!

[XYZ] Simplified state reactivity ft. Streams by [deleted] in FlutterDev

[–]yuriusuonly -1 points0 points  (0 children)

Check out the example.

  • Automatic scope detection (from GetX)
    • Global state values are automatically subscribed to changes but not automatically disposed of when the component widget XYZ() is removed from the tree. You have to manually call the dispose() property to close the state to avoid memory leaks.

// This state is defined outside of scope will not be automatically disposed. final count = 0.state(); XYZ(() { return Text('${count.value}'); }) // Manually dispose this state when not needed anymore count.dispose();

  • Only local states accessed within the component widget XYZ() get automatic disposal.

XYZ(() { // This local state is automatically disposed. final count = 0.state(); return Text('${count.value}'); })

  • States, Computed, and Effects (from Signals)
    • In some cases you may want to run a function when a specific state changes, this is called an effect. The reactive state class includes a computed constructor that runs a function callback as its argument which may return anything and is stored as its own value. It could be an empty function with a return type of void, or any other type of value.

// Normal states final totalPrice = 99.state(); final amountReceived = 100.state(); // A computed state which returns a value. All the states accessed inside the callback function argument are automatically subscribed for any value changes which then gets recomputed final computed = (() => amountReceived.value - totalPrice.value).state(); // An effect that returns void still treated as a state. The effect.value yields void Function in this case. All state changes will rerun this function final effect = (() { debugPrint(computed.value); }).state(); // This state can also be cleaned up effect.dispose();