Hello
How to, pass page variable as custom type and change value of that custom type in the function.
What i wish to achieve is to have specific rendering in list item, who is depending on the month, so i wish to show month label only once, and for that i use page property tmpDate as temporaly/global variable.
As i read and test page value of primitive types int, string, date ... is not passed to function as reference so when i change tmpDate variable it is change only in the function itself.
If i create data type and collection DateType=>{DateTime:date} i cant initiate in custom function if value is null i get always errors, i try 10x flutter examples how to initiate record with or without struct aproach.
import 'dart:convert';
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';
import 'package:timeago/timeago.dart' as timeago;
import '../../flutter_flow/lat_lng.dart';
import '../../flutter_flow/place.dart';
import '../../flutter_flow/uploaded_file.dart';
import '../../flutter_flow/custom_functions.dart';
import '/backend/backend.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import '/backend/schema/structs/index.dart';
import '/auth/firebase_auth/auth_util.dart';
bool? isMonthVisibleDateType(
DateTypeRecord? tmpDate,
DateTime? date,
) {
/// MODIFY CODE ONLY BELOW THIS LINE
print(tmpDate?.date?.month);
print(date?.month);
bool ret = false;
if (tmpDate == null) {
//tmpDate = createDateTypeRecord(date: date!);
//tmpDate.date = date;
print(tmpDate?.date?.month);
ret = true;
} else {
if (tmpDate.date?.month == date?.month) {
tmpDate.date = date;
ret = true;
} else {
ret = false;
}
}
print(tmpDate?.date?.month);
return ret;
/// MODIFY CODE ONLY ABOVE THIS LINE
}