Law of large numbers for a class of random walks in dynamic random environments