我正在尝试安排通知:但我收到此错误:
未处理的异常:在初始化时区数据库之前尝试获取位置
虽然我在 init 函数中初始化了时区:
tz.initializeTimeZones();
Run Code Online (Sandbox Code Playgroud)
时间表代码:
Future<void> scheduleNotifications(String title,int yy,int mm,int dd,int hh,int ii) async {
final loc_egypt = tz.getLocation('Africa/Cairo');
final tz.TZDateTime now = tz.TZDateTime.now(loc_egypt);
var schedule_30before=tz.TZDateTime(loc_egypt,yy,mm,dd,hh,ii).subtract(Duration(minutes: 30));
await flutterLocalNotificationsPlugin.zonedSchedule(
0,
title,
"The Webinar will start after 30 minutes",
schedule_30before,
NotificationDetails(android: _androidNotificationDetails),
androidAllowWhileIdle: true,
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime);
}
Run Code Online (Sandbox Code Playgroud) 我用kotlin制作了一个项目:
Group id-> com.programming.kotlin
Artifact id->chapter01
Module name->chapter01
package->com.programming.kotlin.chapter01
Run Code Online (Sandbox Code Playgroud)
我做了一个名为Program.kt的kotlin类
问题是:当我尝试在包内创建一个新类(称为Program2.kt)时,当我尝试运行它时,我收到此错误:
class com.programming.kotlin.chapter01.Program2kt not found in module 'chapter01_main'
Run Code Online (Sandbox Code Playgroud)
我的问题是:如何允许除Main类之外的任何新类在intellij中运行?
我正在尝试对某些数据使用 firestore,但我在 firestore 控制台错误中看不到任何数据:
(c4326c7) Stream closed with status: Status{code=PERMISSION_DENIED, description=Cloud Firestore API has not been used in project 508621789005 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/firestore.googleapis.com/overview?project=508621789005 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry., cause=null}.
Run Code Online (Sandbox Code Playgroud)
尽管我允许读取,但写入规则为 true。
val db = FirebaseFirestore.getInstance()
// Create a new user with a first and last name
val user: MutableMap<String, Any> = HashMap()
user["first"] = "Ada"
user["last"] …Run Code Online (Sandbox Code Playgroud) Kotlin中的参照平等和结构平等有什么区别?
val a = File("/myfile.txt")
val b = File("/myfile.txt")
val sameRef = a === b
Run Code Online (Sandbox Code Playgroud)
和:
val a = File("/myfile.txt")
val b = File("/myfile.txt")
val both= a == b
Run Code Online (Sandbox Code Playgroud)