Firebase storage flutter - database

i'm just getting this error when i try to run my app
WriteBatchPlatform.verifyExtends(_delegate);
^^^^^^^^^^^^^
: Error: 'Reference' isn't a type.
lib/main_screens/upload_product2.dart:78
firebase_storage.Reference ref = firebase_storage
^^^^^^^^^
: Error: Undefined name 'FirebaseStorage'.
lib/main_screens/upload_product2.dart:79
.FirebaseStorage.instance
^^^^^^^^^^^^^^^

Related

How to change type of a property that gets returned from a method

So I have a method useGetAuthorizationWrapper() which returns { data: unknown } but the expected data that I'll get is an array.
So, when I use data.length I'm getting an error. Obviously, I'll get an error because it is of unknown type.
What I need is => I have to change my return type of data to an array. How can I modify it while calling useGetAuthorizationWrapper() method?
For example like this: useGetAuthorizationWrapper<{ data: [] }>(); // its not working
Under the wood useGetAuthorizationWrapper() calls useQuery() from react-query package
I have searched this issue on the web but didn't get a lead.
When receiving an unknown type you need to cast it:
const wrapper = useGetAuthorizationWrapper();
if (Array.isArray(wrapper.data)) { // just to be sure we have an array
const data = wrapper.data as any[]; // cast unknown field
// do your things
} else {
// handle error
}
However, if possible, you can provide types to useQuery:
by specifying the return and error type: https://react-query-v3.tanstack.com/typescript#defining-custom-hooks (v2 and v3)
by typing the function passed to useQuery and benefitting from type inference https://tanstack.com/query/v4/docs/typescript?#type-inference (v4)

componentDidCatch second parameter not type compatible with function being called from within

I have a standard componentDidCatch in my component, which is typed like below and calls an external Logging library from within:
componentDidCatch(error: Error, info: React.ErrorInfo) {
Logger.logErrorMessage(error.message, info);
}
However the 3rd party logging library logErrorMessage function is typed something like:
type ArbitraryValue = undefined | string | number | boolean | ArbitraryObject;
interface ArbitraryObject {
[p: string]: ArbitraryValue;
}
...
logErrorMessage(message: string, info: ArbitraryObject): void;
The TS error message displays the following
.../ErrorBoundary.tsx:38:82 - error TS2345: Argument of type 'ErrorInfo' is not assignable to parameter of type 'ArbitraryObject'.
Index signature is missing in type 'ErrorInfo'.
38 Logger.logErrorMessage(error, info);
~~~~
What is the best way to get my info parameter of componentDidCatch to adhere to the ArbitraryObject interface of logErrorMessage? Optimally without having to change the Logger library source.

Angular Grunt Uglification Unexpected token punc «}», expected punc «:»

Assuming 'id' is a predefined dynamic variable; why would this not minify correctly?
var uniqueVariable = 'device_' + id;
$scope[uniqueVariable] = {uniqueVariable};
Here is the specific message from grunt-contrib-uglify:
Warning: Uglification failed.
Unexpected token punc «}», expected punc «:».
As Felippe Duarte pointed out, there needs to be a key-pair value, I can't just put any arbitrary string here like I had assumed.

back bone local storage buf.copy is not a function

buffer.js:238
buf.copy(buffer, pos);
^
TypeError: buf.copy is not a function
at Function.Buffer.concat (buffer.js:238:9)
I am getting this error,when I try to include backbone.localstorage

Zend framework Undefined class constant '' in Zend/Db/Select.php

There is a srange error in my Apache Log :
PHP Fatal error: Undefined class constant ''
This is on line 814 of de library (Zend framework 1.11) library/Zend/Db/Select.php
A look of the code :
if ($type == self::FROM) {
// append this from after the last from joinType
$tmpFromParts = $this->_parts[self::FROM];
$this->_parts[self::FROM] = array();
// move all the froms onto the stack
while ($tmpFromParts) {
$currentCorrelationName = key($tmpFromParts);
if ($tmpFromParts[$currentCorrelationName]['joinType'] != self::FROM) {
break;
}
$lastFromCorrelationName = $currentCorrelationName;
$this->_parts[self::FROM][$currentCorrelationName] = array_shift($tmpFromParts);
} }
That's strange because the undefined constant is empty.
THis fatal error appears some times but not at every load of pages.
Is it a release BUG of the zend framework?

Resources