无效参数(callbackUrlScheme):必须是有效的URL方案



我在我的扑动应用程序中使用fitbitter 2.0.1依赖项来显示来自fitbit的健身相关数据。无效参数(callbackUrlScheme):必须是一个有效的URL方案。作为一个错误。关于更多细节,我在下面给出了我的颤振代码:

import 'package:fitbitter/fitbitter.dart';
import 'package:flutter/material.dart';
import '../utils/strings.dart';
class HomePage extends StatelessWidget 
{
HomePage({Key? key}) : super(key: key);
static const route = '/';
static const routename = 'HomePage';
@override
Widget build(BuildContext context) {
print('${HomePage.routename} built');
return Scaffold(
appBar: AppBar(
title: Text(HomePage.routename),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () async {
// Authorize the app and get the Fitbit credentials
FitbitCredentials? fitbitCredentials =
await FitbitConnector.authorize(
clientID: Strings.fitbitClientID,// client id recieved from fitbit
clientSecret: Strings.fitbitClientSecret,// client secret recieved 
//from fitbit
redirectUri: Strings.fitbitRedirectUri,// Auth uri recieved from 
//fitbit
callbackUrlScheme: Strings.fitbitCallbackScheme
);
print(fitbitCredentials);
//Instantiate a proper data manager (for example, for SpO2 data)
FitbitSpO2DataManager fitbitSpO2DataManager =
FitbitSpO2DataManager(
clientID: Strings.fitbitClientID,
clientSecret: Strings.fitbitClientSecret,
);
//Fetch yesterday's data
final spO2Data =
await fitbitSpO2DataManager.fetch(FitbitSpO2APIURL.day(
date: DateTime.now().subtract(Duration(days: 1)),
fitbitCredentials: fitbitCredentials!,
)) as List<FitbitSpO2Data>;
print(spO2Data);
// Use them as you want
if (spO2Data.isNotEmpty) {
final snackBar = SnackBar(
content: Text(
'Yesterday your SpO2 was ${spO2Data[0].avgValue}% on average!'));
ScaffoldMessenger.of(context).showSnackBar(snackBar);
}
},
child: Text('Tap to authorize and fetch data'),
),
],
),
),
);
}
}

所以,请帮我解决这个问题,这样我就可以在我的flutter应用程序中显示用户的健身相关数据,也让我如何为flutter应用程序创建callbackurl。谢谢你的问候

尝试制作redirectUri:名字://回调和callbackUrlScheme:名称

要获取名称,请转到pubspec。在第一行

相关内容

  • 没有找到相关文章

最新更新