skip to Main Content

Flutter – Why does using ref.watch in Riverpod cause my Notifier to be disposed and recreated, but ref.read does not?

I’m working with Flutter Riverpod and have encountered different behaviors when using ref.watch versus ref.read in my DumTabNotifier class. Here’s a simplified version of my code: import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:get/get.dart'; // Notifier class class DumTabNotifier extends Notifier<DumTabState> {…

VIEW QUESTION

Javascript – React useState for object with long string

Is this a bug in React, or am I missing something?? I have an object which has a base64 string. const [ state, updateState ] = useState({ base64: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAMaGlDQ1BJQ0MgUHJvZmlsZQAASImVVwdUU8kanltSSWiBCEgJvQkivUgJoUUQkCrYCEkgocSQEFTsZVHBtSAiihVdFbGtroCsBbE3BHtfLKgo62JBUVTehAR03VfO+8+ZO1+++edvdyZ3BgCtHp5UmoNqA5AryZfFhQezxqakskhPARFoA31gBYby+HIpOzY2CkAZ6P8u728ARNlfdVLa+uf4fxVdgVDOBwAZD3G6QM7PhbgRAHwdXyrLB4Co5C2n5EuVeA7EejIYIMRlSpypwjuUOF2FD/frJMRxIG4BgEzj8WSZAGjegzyrgJ8J7Wh+hthFIhBLANAaBnEAX8QTQKyMfVhu7mQlroDYDupLIYbxAO/072xm/s1++qB9Hi9zEKvy6hdyiFguzeFN+z9L878lN0cx4MMGNppIFhGnzB/W8Fb25EglpkHcKUmPjlHWGuIesUBVdwBQqkgRkajSR435cg6sH2BC7CLghURCbAxxmCQnOkrNp2eIw7gQw9WCThXncxMgNoB4kVAeGq/W2SSbHKf2hdZmyDhsNX+WJ+v3q/T1QJGdyFbbfyMSctX2Mc1CUUIyxFSIrQrESdEQa0LsLM+Oj1TrjCwUcaIHdGSKOGX8VhDHCSXhwSr7WEGGLCxOrV+cKx/IF9skEnOj1Xh/vighQlUf7CSf1x8/zAVrEUrYiQN2hPKxUQO5CIQhoarcsedCSWK82k6PND84TjUXp0pzYtX6uIUwJ1zJW0Ds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VsWURpbWVuc2lvbj4zNDwvZXhpZjpQaXhlbFlEaW1lbnNpb24+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOllSZXNvbHV0aW9uPjE0NDwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAgICAgPHRpZmY6WFJlc29sdXRpb24+MTQ0PC90aWZmOlhSZXNvbHV0aW9uPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KRG43IAAAAAtJREFUCB1j+A8EAAn7A/0Mu1vnAAAAAElFTkSuQmCC" }); When I console out this object the string is empty...…

VIEW QUESTION

Flutter – Call setState outside widgets

Can I call setState from outside the widgets. I try to register the setState of the children widgets - and call it from outside. It don't seem to work - why is that? import 'package:flutter/material.dart'; import 'package:linkimager/sizes.dart'; import 'package:linkimager/store.dart'; void…

VIEW QUESTION
Back To Top
Search