firebase – The method ‘toDouble’ was called on null. Receiver: null Tried calling: toDouble()

Buenas Noches con todos. ya he intentado de varias maneras corregir este error pero no he podido.

ya he intentado cambiando el if por if(!snapshot.hasData && !=null)


También en el builder: intenté cambiarlo por builder:(context,AsyncSnapshot snapshot)

Si alguien puede ayudarme le estaría muy agradecido

El código funcionó perfectamente en otro ejercicio pero ahora que lo aplico a mi caso me sale este error.

se me hace bastante extraño que en un ejercicio similar esto funcione y cuando lea agrego más campos ya no lo haga.

Captura del Error

    import 'package:cloud_firestore/cloud_firestore.dart';
    import 'package:flutter/material.dart';
    import 'package:flutter_slidable/flutter_slidable.dart';
    import 'package:corpore/size_config.dart';

    void main() => runApp(MyApp());

    class MyApp extends StatelessWidget {
      Widget build(BuildContext context) {
         return MaterialApp(
          title: 'staff',
          home: MyHomePage(),

    class MyHomePage extends StatefulWidget {
      _MyHomePageState createState() {
        return _MyHomePageState();

    class _MyHomePageState extends State<MyHomePage> {
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(title: Text('Staff')),
          body: _buildBody(context),

      Widget _buildBody(BuildContext context) {
        return StreamBuilder<QuerySnapshot>(
          stream:     Firestore.instance.collection('schedules').snapshots(),
          builder: (context,snapshot) {
            if ( == null &&     == null){
              return LinearProgressIndicator();

              return _buildList(context,;

      Widget _buildList(BuildContext context,     List<DocumentSnapshot> data) {
        return ListView(
          padding: const EdgeInsets.only(top: 20.0),
          children: => _buildListItem(context,     data)).toList(),

      Widget _buildListItem(BuildContext context,     DocumentSnapshot data) {
        final record = Record.fromSnapshot(data);
        return Padding(
         padding: const EdgeInsets.symmetric(horizontal: 16.0,     vertical: 8.0),
          child: Container(
          decoration: BoxDecoration(
          border: Border.all(color: Colors.grey),
          borderRadius: BorderRadius.circular(5.0)
            child: Slidable(
              key: ValueKey(record.time),
              actionPane: SlidableDrawerActionPane(),
              actionExtentRatio: 0.50,
              child: ListTile(
                title: Text(
                  style: TextStyle(
                    fontFamily: 'BalooMedium',
                    fontSize: (3.00 *     size_config.textMultiplier),
                trailing: Text(
                  style: TextStyle(
                    fontFamily: 'BalooMedium',
                    fontSize: (2.70 *     size_config.textMultiplier),
               secondaryActions: <Widget>(
                   caption: 'Agendar Cita',
                  icon: Icons.check_circle,
                  onTap: () {
                    print('Cita Aceptada');
    class Record {
    final String dnidoc;
    final String dniuser;
    final String lnameuser;
    final String nameuser;
    final String state;
    final String date;
    final String time;
    final DocumentReference reference;
    Record.fromMap(Map<String, dynamic> map, {this.reference})
      : assert(map('dnidoc') != null),
        assert(map('dniuser') != null),
        assert(map('nameuser') != null),
        assert(map('lnameuser') != null),
        assert(map('state') != null),
        assert(map('date') != null),
        assert(map('time') != null),
        dnidoc= map('dnidoc'),
        dniuser= map('dniuser'),
        nameuser= map('nameuser'),
        lnameuser= map('lnameuser'),
        state= map('state'),
        date= map('date'),
        time= map('time');
    Record.fromSnapshot(DocumentSnapshot snapshot)
      : this.fromMap(, reference: snapshot.reference);
    String toString() => "Record<$dnidoc:$dniuser:$nameuser:$lnameuser:$state:$date:$time>";

c – Finding the first null character in a file, if I am going to save everything before it in a malloc() block?

I need to know which is a better option, provided they both work as intended. I need to open a file, and load everything up to the first null character into a malloc()ed block. There is going to be other data after the first null terminator. The file would look like <text I need to read><random binary>. Which option would be better?

First of here’s a struct, because actually I need to record both the data and the size.

struct DataBlock {
    char *Buffer;
    unsigned long Size;

So this?

struct DataBlock MakePreNulltermData(FILE *File) {
    unsigned int Len = 0;
    while (fgetc(File)) {
    char *const Buffer = malloc(Len+1);
    if (!Buffer) {
    fread(Buffer, 1, Len, EntryFile);
    return (struct DataBlock){Buffer, Len};

Or this?

struct DataBlock MakePreNulltermData(FILE* File) {
    fseek(File, 0, SEEK_END);
    unsigned long Size = ftell(File);
    char *Buffer = malloc(Size+1);
    if (!Buffer) {
    fread(Buffer, 1, Size, File);
    const unsigned long Len = memchr(Buffer, 0, Size)-Buffer;
    if (!Buffer = realloc(Buffer, Len)) {
    return (struct DataBlock){Buffer, Len};

The first one reads the data twice from the file. I don’t know how slow that is, but the second one reads any given byte from the file once. But the second needs a bigger malloc() block up front, and then realloc()ed to match the data. The size of the pre-nullterm data is completely arbitrary and estimating the size for the purpose of this question is, well, out of the question. Which should I use given the circumstances, can I make either of them more efficient?

Should I count the number of bytes until the first null char, and allocate once or should I read the entire file into a data block, then count the bytes until the first null char IN RAM in the malloc() block, then resize the malloc block? Read twice and allocate once, or read once and allocate twice?

Query returns NULL – Oracle

I’ve an Oracle query where I need to get some data on the basis of some records (strings). I am using IN clause and query is working fine in TOAD with hardcoded data. But when I run that query through code (Dapper) and pass those strings as Parameters, query always returns NULL/ Empty result.

Here is my query:

SELECT * FROM table WHERE id IN :lstIds

that’s how I’m passing my data as parameter:

using (IDbConnection conn = new DBManager().connection)

            lstData = conn.Query<ViewModelData>(sqlGetData, new
                lstIds = lstIdsParams



and this is my list of Ids, that I am passing as param

enter image description here

If I run same query in TOAD with hardcoded data, it works fine and returns proper data. I don’t know what I am doing wrong in code that is creating issue. Can anyone help me out here??

entities – Get field value from paragraph boolean field programmatically: always empty array / null

I tested this with different names for the field but always with the same problem:

  • In my template_preprocess_paragraph I want to get the value for a boolean field, let’s say it’s machine name is field_test_boolean
  • In the preprocess function I get the paragraph entity $paragraph
  • When I try $paragraph->get('field_test_boolean')->getValue() I always get an empty array
  • When I try $paragraph->field_test_boolean->value I always get NULL

I am quite sure that there is no misspelling when trying to get the value from the field. The returned values never change even when I change the field value in the paragraph edit form. I am really confused…

8 – How to add “null” value in elastic search field if data is empty?

This might be long , but I am trying to make understand my problem. If a field is having empty data then that field is not coming in elastic search index. I want to print something like empty or null in this case.

My use case. I am having a content type “Engagement” which has a field called “Participants” with field type “Paragraph” and it is referenced to another content type called “Stakeholder”. So for each engagement we will have multiple stakeholder values. What I need is to get other field values of stakeholders too. In index we have “+” symbol to get that. The problem we will face here is, since some datas or fields will be empty we will not be able to map the stakeholder.

For eg:- Engagement 1 has 3 paragraphs which is stakeholder content type. Now I will get details of these 3 stakeholders in index. But for some stakeholders some field might be empty. So it will be difficult to map each field values.

loop – get_comments with post_status ‘public’ retrieves NULL result

This is my loop:

<?php $comments = get_comments(array(
    'status' => 'approve',
    'type' => 'comment',
    'number' => 10,
    'post_status' => 'public'
)); ?>

    <ul class="sidebar-comments">
        <?php foreach ($comments as $comment)
{ ?>
                <div><?php echo get_avatar($comment, $size = '35'); ?></div>
                <em style="font-size:12px"><?php echo strip_tags($comment->comment_author); ?></em> (<a href="<?php echo get_option('home'); ?>/?p=<?php echo ($comment->comment_post_ID); ?>/#comment-<?php echo ($comment->comment_ID); ?>">link</a>)<br>
                <?php echo wp_html_excerpt($comment->comment_content, 35); ?>...
} ?>

This always gives an empty result (no errors).
If I remove 'post_status' => 'public' from the get_comments arguments, the function works, comments load but also comments from private posts (which I don’t want).

Any ideas on why 'post_status' => 'public' is not working?

firebase – Mobx observale value is null when used in useEffect hook

I am trying to get userdata from firestore based on uid obtained from authStatechanged in mobx. But when i try to access it in useEffect, it shows value is undefined but if i print its value in body it shows after slight delay. What should i fo to get that value in useeffect.


 useEffect(() => {
    authUser && setuser(authUser) ; //These does not work
    }, ());

  return (
 {authUser && authUser.uid}  //These work



class Store {

  @observable authUser = null

        const result = firebase.auth().onAuthStateChanged(authUser => { 

          this.authUser = authUser

postgresql – Why can’t parameters be null or empty strings when compared in a SELECT in PG?

This is very strange. For a very long time, I’ve been INSERTing parameters into PG queries from PHP like this:

INSERT INTO table (column) VALUES ($1);

The $1 can be a boolean null or an empty string. Works perfectly.

Now, I’m “suddenly” getting errors, probably because I’ve never happened to encountered this situation before:

SELECT * FROM table WHERE column <> $1;

If $1 is either null or an empty string, I get:

pg_query(): Query failed: ERROR:  there is no parameter $1

At first, I thought it might be logically related to the <> operator, but this also gives the very same error:

SELECT * FROM table WHERE column = $1;

I have foggy memories of NULL being annoyingly “special case” in PG, but even empty strings? And why specifically for SELECTs but not INSERTs?

php – Uncaught TypeError: Cannot read property ‘firstChild’ of null after upgrading to WordPress 5.5

I am getting the following error from comment-reply.min.js (which seems to be a WordPress file):

Uncaught TypeError: Cannot read property 'firstChild' of null
    at comment-reply.min.js?ver=026d5828124b6319675d89d24f212b97:2
    at Object.moveForm (comment-reply.min.js?ver=026d5828124b6319675d89d24f212b97:2)
    at HTMLAnchorElement.a (comment-reply.min.js?ver=026d5828124b6319675d89d24f212b97:2)

Is this a known issue after upgrading to WordPress 5.5 or should I start debugging it?

What would be the best way to address it?

We have not changed the comments template but only upgraded to the latest version of WordPress.

The relevant part of the template is:

<?php comment_id_fields($_GET("post_id")); ?>
<?php do_action('comment_form', $_GET("post_id")); ?>
<div class="fl-comment-form-cancel">
   <?php cancel_comment_reply_link(); ?>

After a quick check, it seems it is searching for an element with the id wp-temp-form-div, which does not exist.

And the issue seems to be here:

, r = E(h.commentReplyTitleId)
, o = void 0 !== r ? r.firstChild.textContent : “”;

If commentReplyTitleId does not exist, r will be null, hence different than undefined, so it tries to get the firstChild.

A quick workaround I’m using:

(function () {
    var oldGet = document.getElementById.bind(document)
    document.getElementById = function (id) { return oldGet(id) || undefined; }

But to me it seems like a bug in 5.5.

c – Finding the first null character in a file

May I have a code review on how I can improve my code to find the first null character in a file? The first malloc is the entire size of the file. I’m only reading it in chunks, and then scanning each chunk. Is there a way to handle an expanding buffer of entries instead of assuming the max possible size or calling realloc() in a for loop? What’s the best way to do this? To find the location of the first null character in a file?

unsigned long MyFunc(FILE *File) {
    fseek(File, 0, SEEK_END);
    unsigned long Size = ftell(File);
    char *Buffer = malloc(Size+7);
    if (!Buffer) {
    unsigned long Len = Size;
    for (char *Ptr = Buffer; Ptr < Buffer+Size; Ptr+=8) {
        fgets(Ptr, 8, File);
        char *ChrPtr = memchr(Ptr, 0, 8);
        if (ChrPtr) {
            Len = Buffer-ChrPtr;
    return Len; //Result

Also this doesn’t have to do with anything but I’m only contributing anonymous over guest accounts, because StackExchange moderation sucks and deleted and suspended my previous accounts for no clear reason as soon as I start to get good. Like on my previous accounts I never misbehaved, and I’m actually the author of question 245257, but all of a sudden the account I used to ask it got suspended network-wide for almost 3 centuries. Again, for no clear reason. All I got was some Locking and goodbye mod messages on StackOverflow. Like what the fuck did I do wrong? The site an concept of a Q&A site like this is cool, the user interface is friendly enough, but the moderators are mean (especially on StackOverflow and Arqade and Gamedev and especially on Meta). So I was like fuck this I’m just going to participate as unregistered guest accounts and self-delete my account once I’ve accepted an answer to anonymize my post, so the moderators can’t target me. But Codereview moderators seem OK. That part is irrelevant, it’s just a me ranting.