So im trying to get an array of timestamps from 2 times in flutterflow. ex. time1 06:00, time2 06:05 the result would be 06:00, 06:01, 06:02, 06:03, 06:04, 06:05.
Im using a custom function so somebody please help
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/custom_functions.dart';
import '/backend/backend.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import '/auth/firebase_auth/auth_util.dart';
List<DateTime> occupiedTime(
DateTime from,
DateTime to,
) {
/// MODIFY CODE ONLY BELOW THIS LINE
List<DateTime> occupiedTime(
DateTime from,
DateTime to, [
Duration duration = const Duration(minutes: 1),
]) {
List<DateTime> timestamps = [];
while (from.isBefore(to) || from.isAtSameMomentAs(to)) {
timestamps.add(from);
from = from.add(duration);
}
return timestamps;
}
/// MODIFY CODE ONLY ABOVE THIS LINE
}
i tried this code but no matter what i try to return it gives me error