So Im building a flutter app, where I want iOS Widgets.
For that I built a simple Widget with WidgetKit in Swift
import WidgetKit
import SwiftUI
struct MediumWorkout: View {
var entry: TrainingEntry
var body: some View {
// I tried replacing the interval_timer with intervaltimer - the interval timer thing comes from my pubspec.yaml, its the name of my app
Link(destination: URL(string: "interval_timer://profile")!) {
Text(intervalString)
}
}
}
But Im not able to navigate from the Widget, to the specific destination in my flutter app. The widget just routes to my initial route "workouts"
initialRoute: '/workouts',
routes: {
'/workouts': (context) => const Home(screenIndex: 0),
'/jumpin': (context) => const Home(screenIndex: 1),
'/profile': (context) => const Home(screenIndex: 2),
},
even though I want it to navigate to the profile section.
I guessed that its maybe because my routing in flutter isnt compatible with the swift one. Has anyone done this before & how can I solve the problem
You could force an action to a specific route before initializing MaterialApp, using the Fluro (or GetX) plugin as follows: