hi I want to send token with my api url i tried it by concatenate the token with api url but not. it's showing the error you cannot call the value on null. i cannot figure it out. any help from your side should be appreciate.

This is my api code:

class APIService {
  String baseurl = "https://b2all.live/api";
  var log = Logger();
  FlutterSecureStorage storage = FlutterSecureStorage();

  //old get

  Future get(String url) async {
    await storage.read(key: "api_token");
    url = formater(url);
    // /user/register
    var response = await http.get(
    if (response.statusCode == 200) {
      return json.decode(response.body);

  String formater (String url) {
    return baseurl+url;

And this is my fetching data from api code:

  void initState() {

  void fetchData() async {
    var preferences = await SharedPreferences.getInstance();
    String api_token = preferences.getString('api_token');

    var response = await networkHandler.get(

    setState(() {
      profileModelFix = ProfileModelFix.fromJson(response);
      circular = false;

this is my model file. it's showing error on model. but i cannot figure it out. any help from your side will be helpful for me.

import 'package:flutter/foundation.dart';
import 'package:json_annotation/json_annotation.dart';

part 'profileModelFix.g.dart';

class ProfileModelFix {
  String name;
  String user_name;
  String dob;
  String phone;
  String gender;
  String bio;
  String api_token;

  ProfileModelFix ({

    this.name, this.user_name, this.dob, this.phone, this.gender, this.bio, this.api_token,

  factory ProfileModelFix.fromJson(Map<String,dynamic> json) =>
  Map<String,dynamic> toJson() => _$ProfileModelFixToJson(this);