Unable to "import 'dart:typed_data';" in Custom Function

Custom Code
Resolved

I am currently trying my first Custom Function for FlutterFlow. What I want to do is simple: Convert an uploaded PDF into base64 and save it as a String variable. The code I am using for this is very straight forward:

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';

String? newCustomFunction(FFUploadedFile uploadedFile) {
  /// MODIFY CODE ONLY BELOW THIS LINE

// Convert the uploaded PDF file into Base64
  Uint8List fileBytes = uploadedFile.bytes!;
  String base64String = base64Encode(fileBytes);

  return base64String;

  /// MODIFY CODE ONLY ABOVE THIS LINE
}

Without importing dart:typed_data I was able to save this custom function but now I get the following error message when I want to test my App:
"lib/flutter_flow/custom_functions.dart:16:3: Error: 'Uint8List' isn't a type. Uint8List fileBytes = uploadedFile.bytes!; ^^^^^^^^^ Waiting for connection from debug service on Web Server... 44.2s Failed to compile application."

I was confident this problem could have been solved by simply adding "import 'dart:typed_data';" to my code, but I am unable so save any changes outside of the main string function. Is there an easy solution that I am overlooking right now?

I highly appreciate any help :)

What have you tried so far?

I already tried importing the package and changing the code so I will be able to save the function but then I get the error message "The function is empty or cannot be parsed." When I remove the added import I can save it again but will also get the same error message in my test-run.

Did you check FlutterFlow's Documentation for this topic?
Yes
3
3 replies